|
@@ -6,8 +6,6 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
|
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
|
|
-import org.springframework.context.ApplicationContext;
|
|
|
-import org.springframework.context.ApplicationContextAware;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
/**
|
|
@@ -16,33 +14,16 @@ import org.springframework.stereotype.Component;
|
|
|
* @author ruoyi
|
|
|
*/
|
|
|
@Component
|
|
|
-public final class SpringUtils implements ApplicationContextAware
|
|
|
+public final class SpringUtils implements BeanFactoryPostProcessor
|
|
|
{
|
|
|
-
|
|
|
- private static ApplicationContext beanFactory;
|
|
|
+ /** Spring应用上下文环境 */
|
|
|
+ private static ConfigurableListableBeanFactory beanFactory;
|
|
|
|
|
|
@Override
|
|
|
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
|
|
- if(SpringUtils.beanFactory == null) {
|
|
|
- SpringUtils.beanFactory = applicationContext;
|
|
|
- }
|
|
|
- System.out.println("---------------------------------------------------------------------");
|
|
|
-
|
|
|
- System.out.println("---------------------------------------------------------------------");
|
|
|
-
|
|
|
- System.out.println("---------------com.hcloud.microserver.commoncore.util------------------------------------------------------");
|
|
|
-
|
|
|
- System.out.println("---------------------------------------------------------------------");
|
|
|
+ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
|
|
|
+ {
|
|
|
+ SpringUtils.beanFactory = beanFactory;
|
|
|
}
|
|
|
-// /** Spring应用上下文环境 */
|
|
|
-// private static ConfigurableListableBeanFactory beanFactory;
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// @Autowired
|
|
|
-// public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
|
|
|
-// {
|
|
|
-// SpringUtils.beanFactory = beanFactory;
|
|
|
-// }
|
|
|
|
|
|
/**
|
|
|
* 获取对象
|