美文网首页
BeanFactoryPostProcessor 通过父类获取子

BeanFactoryPostProcessor 通过父类获取子

作者: 令76 | 来源:发表于2018-10-30 23:46 被阅读0次
    @Component
    
    public class MyBeanFactoryPostProcessorimplements BeanFactoryPostProcessor {
    
    @Override
    
        public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)throws BeansException {
    
          String[] names = beanFactory.getBeanNamesForType(BaseRequest.class);
    
          System.out.println("===================================================================");
    
          for(String name:names){
    
              BeanDefinition definition = beanFactory.getBeanDefinition(name);
    
              String className= definition.getBeanClassName();
    
              System.out.println(className);
    
              definition.setLazyInit(true);
    
          }
    
          System.out.println(Arrays.asList(names));
    
          System.out.println("===================================================================");
    
        }
    
    }
    

    相关文章

      网友评论

          本文标题:BeanFactoryPostProcessor 通过父类获取子

          本文链接:https://www.haomeiwen.com/subject/ssfotqtx.html