package com.chenyang.nse.bussiness.tools.jdbc;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.stereotype.Component;

@Component
public class BeanFactory implements BeanFactoryAware {
   public static org.springframework.beans.factory.BeanFactory beanFactory;

   public void setBeanFactory(org.springframework.beans.factory.BeanFactory arg0) throws BeansException {
      beanFactory = arg0;
   }

   public static <T> T getBean(Class<T> requiredType) {
      return (T)(beanFactory != null ? beanFactory.getBean(requiredType) : null);
   }
}
