Stéphane Nicoll opened SPR-14654 and commented
While working on #16509 I noticed that caching several ClassPathScanningCandidateComponentProvider instances are instantiated when the application context is refreshed. With Spring Boot in particular, those instances are working on the same base package(s) with different filters.
In the end we scan the same Resources, load the same meta-data and figure out based on that if we have to include the component.
It would be much nicer if that information was cached for the duration of the refresh. Also, creating a valid ClassPathScanningCandidateComponentProvider requires you to pass the Environment and the ResourceLoader. Both of those are available from ApplicationContext. Perhaps the latter could take care of providing a shared instance or something?
Affects: 5.0 M1
Issue Links:
Referenced from: commits 7818c65
Stéphane Nicoll opened SPR-14654 and commented
While working on #16509 I noticed that caching several
ClassPathScanningCandidateComponentProviderinstances are instantiated when the application context is refreshed. With Spring Boot in particular, those instances are working on the same base package(s) with different filters.In the end we scan the same
Resources, load the same meta-data and figure out based on that if we have to include the component.It would be much nicer if that information was cached for the duration of the refresh. Also, creating a valid
ClassPathScanningCandidateComponentProviderrequires you to pass theEnvironmentand theResourceLoader. Both of those are available fromApplicationContext. Perhaps the latter could take care of providing a shared instance or something?Affects: 5.0 M1
Issue Links:
Referenced from: commits 7818c65