You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JavaDoc and reference docs now warn developers against interacting with
bean instances within BeanFactoryPostProcessor implementations in order
to avoid premature bean instantiation.
See SPR-7450 for an example of a third-party BFPP
(OAuthTokenLifecycleRegistryPostProcessor) prematurely instantiating
a FactoryBean instance, such that bean post-processing is bypassed
and autowired injection (via @Inject) never occurs.
Copy file name to clipboardExpand all lines: org.springframework.beans/src/main/java/org/springframework/beans/factory/config/BeanFactoryPostProcessor.java
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,12 @@
31
31
* <p>See PropertyResourceConfigurer and its concrete implementations
32
32
* for out-of-the-box solutions that address such configuration needs.
33
33
*
34
+
* <p>A BeanFactoryPostProcessor may interact with and modify bean
35
+
* definitions, but never bean instances. Doing so may cause premature bean
36
+
* instantiation, violating the container and causing unintended side-effects.
37
+
* If bean instance interaction is required, consider implementing
0 commit comments