It is now possible to enable global lazy initialization to reduce startup time via the spring.main.lazy-initialization property. Please note that using that feature comes at a cost:
Handling of HTTP requests may take longer while any deferred initialisation occurs
Failures that would normally occur at startup will now not occur until later
Individual beans can opt out of lazy initialization by annotating their definition with @Lazy(false). Where it is not possible to use @Lazy(false) to opt out of lazy initialization, a LazyInitializationExcludeFilter bean can be used instead. For example, to never set IntegrationFlow beans to lazy, you can use the following code:
@Bean
static LazyInitializationExcludeFilter integrationLazyInitExcludeFilter() {
return LazyInitializationExcludeFilter.forBeanTypes(IntegrationFlow.class);
}