Description
The Spring Boot team has been investigating startup time improvements by not relying on the proxy capabilities of configuration classes. Turns out that not using that stuff (basically switching all auto-configurations and related imports to "lite mode") makes quite a difference spring-projects/spring-boot#9068 (comment)
I am not a big fan that we were looking for @Bean
methods in any component, treating them in lite mode if they don't have the @Configuration
stereotype. I was wondering if we would be open to revisit this in the 5.2 line.
Being able to opt-out from the proxy mode using the @Configuration
stereotype would be ideal. We are not keen to remove @Configuration
and use the lite mode as it stands as:
- That's not representative of what a good citizen of the framework should do (using the right stereotype)
- We have an annotation processor that identifies configuration classes to extract conditions so that we can back off (without loading the ASM metadata or the class) when a static condition does not match (i.e. class not on the classpath)
Having a way to opt-out would be also a nice opportunity to clarify the behaviour and stop scanning components for bean factory methods.