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

后端 未结 3 1483
醉梦人生
醉梦人生 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:28

    As of version 4.1 RC2, this bug is fixed, and you can accomplish lazy loading on component scan with:

    @ComponentScan(basePackages = ["..."], lazyInit = true)
    

    https://jira.spring.io/browse/SPR-10459

提交回复
热议问题