實現以下所有的接口都只調用一次。
實現BeanFactoryPostProcessor
接口
正如這個接口名字暗示的:在BeanFactory初始化之后調用。
測試BeanFactoryPostProcessor
回調接口的調用時機
BeanPostProcessor
接口的實現:
User
類:
運行結果:
BeanDefinitionRegistryPostProcessor
接口
BeanDefinitionRegistryPostProcessor
繼承BeanFactoryPostProcessor
,類似BeanFactoryPostProcessor
。
BeanDefinitionRegistryPostProcessor
提供了postProcessBeanDefinitionRegistry
,提供了手工注冊bean的方法。