org.springframework.context.annotation.ImportBeanDefinitionRegistrar;这个接口是spring 对外提供的接口,目的是实现bean的动态注入。
- 实现这个接口的类可以在使用@Configuration的地方引入,然后实现动态的bean注入到spring容器,这个是在在@Bean注解定义bean 后动态的注入bean。
使用方法:和使用@Configuration 和 ImportSelector 类似,通过@Import 引入;
2. 一个ImportBeanDefinitionRegistrar接口的实现类也可以实现 org.springframework.beans.factory.Aware Aware
(org.springframework.context.EnvironmentAware EnvironmentAware,
org.springframework.beans.factory.BeanFactoryAware BeanFactoryAware,
org.springframework.beans.factory.BeanClassLoaderAware BeanClassLoaderAware,
org.springframework.context.ResourceLoaderAware ResourceLoaderAware )
接口的方法,并且 这些Aware的方法比ImportBeanDefinitionRegistrar 的方法更先执行。