How to load all beans lazily with @ComponentScan in Spring?

后端 未结 3 1487
醉梦人生
醉梦人生 2020-12-11 01:23

I am using Java-based config to set up my Spring application context like this:

@Configuration
@Lazy
@ComponentScan(basePackageClasses = {MyProject.class, Ot         


        
3条回答
  •  渐次进展
    2020-12-11 01:50

    From Spring Boot 2.2, you can set a property to true (default to false) to enable the lazy initialization :

    spring.main.lazy-initialization=true
    

提交回复
热议问题