Package org.springframework.boot
Interface LazyInitializationExcludeFilter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
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.
- Since:
- 2.2.0
- Author:
- Tyler Van Gorder, Philip Webb
-
Method Summary
Modifier and TypeMethodDescriptionforBeanTypes
(Class<?>... types) Factory method that creates a filter for the given bean types.boolean
isExcluded
(String beanName, BeanDefinition beanDefinition, Class<?> beanType) Returnstrue
if the specified bean definition should be excluded from havinglazy-init
automatically set.
-
Method Details
-
isExcluded
Returnstrue
if the specified bean definition should be excluded from havinglazy-init
automatically set.- Parameters:
beanName
- the bean namebeanDefinition
- the bean definitionbeanType
- the bean type- Returns:
true
iflazy-init
should not be automatically set
-
forBeanTypes
Factory method that creates a filter for the given bean types.- Parameters:
types
- the filtered types- Returns:
- a new filter instance
-