@ HormDao
Public interface HormTestDao extends IBaseDao{
}
@ HormDao
Public class SpringDaoImpl {
}
@ Component
Public class BaseDaoRegisterBean implements ApplicationContextAware, BeanDefinitionRegistryPostProcessor {
Private BeanDefinitionRegistry registry;
Private ApplicationContext context;
@ Override
Public void postProcessBeanFactory (ConfigurableListableBeanFactory the beanFactory) throws BeansException {
}
@ Override
Public void postProcessBeanDefinitionRegistry (BeanDefinitionRegistry registry) throws BeansException {
This. Registry=registry;
MapBeans=context. GetBeansWithAnnotation (HormDao. Class);
For (Map. EntryEntry: beans. EntrySet ()) {
System. Out.println (entry. GetKey () + "- & gt;" + (entry. GetValue (). GetClass ()));
}
}
@ Override
Public void setApplicationContext (ApplicationContext ApplicationContext) throws BeansException {
Enclosing context=applicationContext;
}
}
CodePudding user response:
The interface cannot be instantiated, not in containers