@Configuration proxyMethods usage warnings
Reports warnings on incorrectly used proxy methods. Spring Framework 5.2 has introduced an optimization for @Configuration class processing that can be enabled via an attribute @Configuration(proxyBeanMethods = false).
If you disable proxyBeanMethods
, the proxy instances are no longer created and calling the method invokes it again (returning a new instance every time). As a result, you have no guarantee that you're actually injecting the corresponding bean in the context.
Incorrect bean method call example:
You can set proxyBeanMethods
to true or rewrite the code as follows:
Also, the inspection checks @Bean
method calls in a class without the @Configuration
stereotype (in "bean lite mode"):
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Spring, 233.SNAPSHOT |