-
Couldn't load subscription status.
- Fork 38.8k
Description
I believe that it's generally recommended for a BeanPostProcessor that's defined as a @Bean to use a static method and for the method to, ideally, have no dependencies. The goal being to minimise the chances of the BPP triggering eager initialization that makes other beans ineligible for full post-processing.
I thought this was mentioned in the reference documentation but I have been unable to find it. https://docs.spring.io/spring-framework/reference/core/beans/factory-extension.html#beans-factory-extension-bpp talks a little about it, but only in the context of AOP auto-proxying as far as I can see. I think the advice should apply more broadly. There's also no Java example of registering a BPP, instead XML is used which missed the opportunity to recommend the use of static when a @Bean method is involved.