I am working on my first Spring Boot application and I have the following problem.
I want to set the that for default all beans are lazy loaded. I know that I can add the @Lazy
to all my @Component
beans but I want that for default all beans are setted at lazy...
In Spring Boot I don't have an XML configuration file or a configuration class but I only have an application.properties
configuration file.
So, how can I set that the default behavior for all the bean is lazy=true
BeanFactoryPostProcessor
that sets theLazyInit
property of all bean definitions to lazy. You might want to exclude everything that is marked as anINFRASTRUCTURE
bean. Or simply place@Lazy
on the main application class. – Rocambole