BeanPostProcessor postProcessAfterInitialization 是否只需要与代理一起使用?
Is BeanPostProcessor postProcessAfterInitialization needed only to work with proxy?
A bean implementing BeanPostProcessor is called when all bean
definitions will have been loaded, but no beans will have been
instantiated yet
BeanPostprocessor is executed after the bean object is created, as it
can be executed before init() and after init().
BeanPostProcessor
postProcessAfterInitialization
只需要使用代理吗?
更新: 我们需要 2 种方法 postProcessBeforeInitialization
和 postProcessAfterInitialization
有什么用?为什么不只有一个 postProcessInitialization
?
@Nullable
default Object postProcessAfterInitialization(Object bean,
String beanName)
throws BeansException
在任何 bean 初始化回调(如 InitializingBean 的 afterPropertiesSet 或自定义初始化方法)之后,将此 BeanPostProcessor 应用于给定的新 bean 实例。该 bean 已经填充了 属性 值。返回的 bean 实例可能是原始实例的包装器。
A bean implementing BeanPostProcessor is called when all bean definitions will have been loaded, but no beans will have been instantiated yet
BeanPostprocessor is executed after the bean object is created, as it can be executed before init() and after init().
BeanPostProcessor
postProcessAfterInitialization
只需要使用代理吗?
更新: 我们需要 2 种方法 postProcessBeforeInitialization
和 postProcessAfterInitialization
有什么用?为什么不只有一个 postProcessInitialization
?
@Nullable
default Object postProcessAfterInitialization(Object bean,
String beanName)
throws BeansException
在任何 bean 初始化回调(如 InitializingBean 的 afterPropertiesSet 或自定义初始化方法)之后,将此 BeanPostProcessor 应用于给定的新 bean 实例。该 bean 已经填充了 属性 值。返回的 bean 实例可能是原始实例的包装器。