LazyInitializationExcludeFilter

Filter that can be used to exclude beans definitions from having their lazy-init set by the LazyInitializationBeanFactoryPostProcessor.

Primarily intended to allow downstream projects to deal with edge-cases in which it is not easy to support lazy-loading (such as in DSLs that dynamically create additional beans). Adding an instance of this filter to the application context can be used for these edge cases.

A typical example would be something like this:

@Bean
public static LazyInitializationExcludeFilter integrationLazyInitializationExcludeFilter() {
  return LazyInitializationExcludeFilter.forBeanTypes(IntegrationFlow.class);
}

NOTE: Beans of this type will be instantiated very early in the spring application lifecycle so they should generally be declared static and not have any dependencies.

Author

Tyler Van Gorder

Philip Webb

Since

2.2.0

Functions

Link copied to clipboard
Factory method that creates a filter for the given bean types.
Link copied to clipboard
abstract fun isExcluded(beanName: String, beanDefinition: BeanDefinition, beanType: Class<out Any>): Boolean
Returns true if the specified bean definition should be excluded from having lazy-init automatically set.