@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("===================================================================");
}
}
网友评论