public interface BeanDefinitionRegistry
Core bean definition registry interface containing methods to find BeanDefinition instances.
| Modifier and Type | Method and Description |
|---|---|
default <T> boolean |
containsBean(Argument<T> beanType)
Return whether the bean of the given type is contained within this context.
|
default <T> boolean |
containsBean(Argument<T> beanType,
Qualifier<T> qualifier)
Return whether the bean of the given type is contained within this context.
|
default boolean |
containsBean(Class<?> beanType)
Return whether the bean of the given type is contained within this context.
|
<T> boolean |
containsBean(Class<T> beanType,
Qualifier<T> qualifier)
Return whether the bean of the given type is contained within this context.
|
Optional<BeanConfiguration> |
findBeanConfiguration(String configurationName)
Obtain a bean configuration by name.
|
default <T> Optional<BeanDefinition<T>> |
findBeanDefinition(Argument<T> beanType)
Obtain a
BeanDefinition for the given type. |
default <T> Optional<BeanDefinition<T>> |
findBeanDefinition(Argument<T> beanType,
Qualifier<T> qualifier)
Obtain a
BeanDefinition for the given type. |
default <T> Optional<BeanDefinition<T>> |
findBeanDefinition(Class<T> beanType)
Obtain a
BeanDefinition for the given type. |
<T> Optional<BeanDefinition<T>> |
findBeanDefinition(Class<T> beanType,
Qualifier<T> qualifier)
Obtain a
BeanDefinition for the given type. |
<T> Optional<BeanRegistration<T>> |
findBeanRegistration(T bean)
Obtain a
BeanDefinition for the given bean. |
<T> Optional<BeanDefinition<T>> |
findProxyBeanDefinition(Argument<T> beanType,
Qualifier<T> qualifier)
Obtain the original
BeanDefinition for a ProxyBeanDefinition. |
<T> Optional<BeanDefinition<T>> |
findProxyBeanDefinition(Class<T> beanType,
Qualifier<T> qualifier)
Obtain the original
BeanDefinition for a ProxyBeanDefinition. |
default <T> Optional<BeanDefinition<T>> |
findProxyTargetBeanDefinition(Argument<T> beanType,
Qualifier<T> qualifier)
Obtain the original
BeanDefinition for a ProxyBeanDefinition. |
<T> Optional<BeanDefinition<T>> |
findProxyTargetBeanDefinition(Class<T> beanType,
Qualifier<T> qualifier)
Obtain the original
BeanDefinition for a ProxyBeanDefinition. |
<T> Collection<BeanRegistration<T>> |
getActiveBeanRegistrations(Class<T> beanType)
Find active
Singleton beans for the given bean type. |
Collection<BeanRegistration<?>> |
getActiveBeanRegistrations(Qualifier<?> qualifier)
Find active
Singleton beans for the given qualifier. |
Collection<BeanDefinition<?>> |
getAllBeanDefinitions()
Get all of the registered
BeanDefinition. |
default <T> BeanDefinition<T> |
getBeanDefinition(Argument<T> beanType)
Obtain a
BeanDefinition for the given type. |
default <T> BeanDefinition<T> |
getBeanDefinition(Argument<T> beanType,
Qualifier<T> qualifier)
Obtain a
BeanDefinition for the given type. |
default <T> BeanDefinition<T> |
getBeanDefinition(Class<T> beanType)
Obtain a
BeanDefinition for the given type. |
default <T> BeanDefinition<T> |
getBeanDefinition(Class<T> beanType,
Qualifier<T> qualifier)
Obtain a
BeanDefinition for the given type. |
Collection<BeanDefinitionReference<?>> |
getBeanDefinitionReferences()
Get all of the enabled
BeanDefinitionReference. |
default <T> Collection<BeanDefinition<T>> |
getBeanDefinitions(Argument<T> beanType)
Obtain a
BeanDefinition for the given type. |
default <T> Collection<BeanDefinition<T>> |
getBeanDefinitions(Argument<T> beanType,
Qualifier<T> qualifier)
Obtain a
BeanDefinition for the given type. |
<T> Collection<BeanDefinition<T>> |
getBeanDefinitions(Class<T> beanType)
Obtain a
BeanDefinition for the given type. |
<T> Collection<BeanDefinition<T>> |
getBeanDefinitions(Class<T> beanType,
Qualifier<T> qualifier)
Obtain a
BeanDefinition for the given type. |
Collection<BeanDefinition<?>> |
getBeanDefinitions(Qualifier<Object> qualifier)
Get all of the
BeanDefinition for the given qualifier. |
default <T> BeanRegistration<T> |
getBeanRegistration(Argument<T> beanType,
Qualifier<T> qualifier)
Find a bean registration for the given bean type and optional qualifier.
|
<T> BeanRegistration<T> |
getBeanRegistration(Class<T> beanType,
Qualifier<T> qualifier)
Find a bean registration for the given bean type and optional qualifier.
|
default <T> Collection<BeanRegistration<T>> |
getBeanRegistrations(Argument<T> beanType,
Qualifier<T> qualifier)
Find and if necessary initialize
Singleton beans for the given bean type, returning all the active registrations. |
<T> Collection<BeanRegistration<T>> |
getBeanRegistrations(Class<T> beanType)
Find and if necessary initialize
Singleton beans for the given bean type, returning all the active registrations. |
<T> Collection<BeanRegistration<T>> |
getBeanRegistrations(Class<T> beanType,
Qualifier<T> qualifier)
Find and if necessary initialize
Singleton beans for the given bean type, returning all the active registrations. |
default <T> BeanDefinition<T> |
getProxyTargetBeanDefinition(Argument<T> beanType,
Qualifier<T> qualifier)
Obtain the original
BeanDefinition for a ProxyBeanDefinition. |
default <T> BeanDefinition<T> |
getProxyTargetBeanDefinition(Class<T> beanType,
Qualifier<T> qualifier)
Obtain the original
BeanDefinition for a ProxyBeanDefinition. |
default <T> BeanDefinitionRegistry |
registerSingleton(Class<T> type,
T singleton)
Registers a new singleton bean at runtime.
|
default <T> BeanDefinitionRegistry |
registerSingleton(Class<T> type,
T singleton,
Qualifier<T> qualifier)
Registers a new singleton bean at runtime.
|
<T> BeanDefinitionRegistry |
registerSingleton(Class<T> type,
T singleton,
Qualifier<T> qualifier,
boolean inject)
Registers a new singleton bean at runtime.
|
default BeanDefinitionRegistry |
registerSingleton(Object singleton)
Registers a new singleton bean at runtime.
|
default BeanDefinitionRegistry |
registerSingleton(Object singleton,
boolean inject)
Registers a new singleton bean at runtime.
|
<T> boolean containsBean(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
T - The concrete typebeanType - The bean typequalifier - The qualifier for the beandefault <T> boolean containsBean(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
T - The concrete typebeanType - The bean typequalifier - The qualifier for the beandefault <T> boolean containsBean(@NonNull Argument<T> beanType)
T - The concrete typebeanType - The bean type@NonNull <T> BeanDefinitionRegistry registerSingleton(@NonNull Class<T> type, @NonNull T singleton, @Nullable Qualifier<T> qualifier, boolean inject)
Registers a new singleton bean at runtime. This method expects that the bean definition data will have been compiled ahead of time.
If bean definition data is found the method will perform dependency injection on the instance followed by
invoking any PostConstruct hooks.
If no bean definition data is found the bean is registered as is.
T - The concrete typetype - The bean typesingleton - The singleton beanqualifier - The bean qualifierinject - Whether the singleton should be injected (defaults to true)@NonNull Optional<BeanConfiguration> findBeanConfiguration(@NonNull String configurationName)
configurationName - The configuration name@NonNull <T> Optional<BeanDefinition<T>> findBeanDefinition(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
BeanDefinition for the given type.T - The concrete typebeanType - The typequalifier - The qualifierOptional of the bean definitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given type@NonNull default <T> Optional<BeanDefinition<T>> findBeanDefinition(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
BeanDefinition for the given type.T - The concrete typebeanType - The potentially parameterized typequalifier - The qualifierOptional of the bean definitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given type@NonNull default <T> Optional<BeanDefinition<T>> findBeanDefinition(@NonNull Argument<T> beanType)
BeanDefinition for the given type.T - The concrete typebeanType - The potentially parameterized typeOptional of the bean definitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given type@NonNull <T> Optional<BeanRegistration<T>> findBeanRegistration(@NonNull T bean)
BeanDefinition for the given bean.T - The concrete typebean - The beanOptional of the bean definitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given type@NonNull <T> Collection<BeanDefinition<T>> getBeanDefinitions(@NonNull Class<T> beanType)
BeanDefinition for the given type.T - The concrete typebeanType - The typeOptional of the bean definitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given type@NonNull default <T> Collection<BeanDefinition<T>> getBeanDefinitions(@NonNull Argument<T> beanType)
BeanDefinition for the given type.T - The concrete typebeanType - The typeOptional of the bean definitionNonUniqueBeanException - When multiple possible
bean definitions exist for the given type@NonNull <T> Collection<BeanDefinition<T>> getBeanDefinitions(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
BeanDefinition for the given type.T - The concrete typebeanType - The typequalifier - The qualifierOptional of the bean definitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given type@NonNull default <T> Collection<BeanDefinition<T>> getBeanDefinitions(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
BeanDefinition for the given type.T - The concrete typebeanType - The typequalifier - The qualifierOptional of the bean definitionNonUniqueBeanException - When multiple possible
bean definitions exist for the given type@NonNull Collection<BeanDefinition<?>> getBeanDefinitions(@NonNull Qualifier<Object> qualifier)
BeanDefinition for the given qualifier.qualifier - The qualifier@NonNull Collection<BeanDefinition<?>> getAllBeanDefinitions()
BeanDefinition.@NonNull Collection<BeanDefinitionReference<?>> getBeanDefinitionReferences()
BeanDefinitionReference.@NonNull Collection<BeanRegistration<?>> getActiveBeanRegistrations(@NonNull Qualifier<?> qualifier)
Singleton beans for the given qualifier. Note that
this method can return multiple registrations for a given singleton bean instance since each bean may have multiple qualifiers.qualifier - The qualifier@NonNull <T> Collection<BeanRegistration<T>> getActiveBeanRegistrations(@NonNull Class<T> beanType)
Singleton beans for the given bean type. Note that
this method can return multiple registrations for a given singleton bean instance since each bean may have multiple qualifiers.T - The concrete typebeanType - The bean type@NonNull <T> Collection<BeanRegistration<T>> getBeanRegistrations(@NonNull Class<T> beanType)
Singleton beans for the given bean type, returning all the active registrations. Note that
this method can return multiple registrations for a given singleton bean instance since each bean may have multiple qualifiers.T - The concrete typebeanType - The bean type@NonNull <T> Collection<BeanRegistration<T>> getBeanRegistrations(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
Singleton beans for the given bean type, returning all the active registrations. Note that
this method can return multiple registrations for a given singleton bean instance since each bean may have multiple qualifiers.T - The concrete typebeanType - The bean typequalifier - The qualifier@NonNull default <T> Collection<BeanRegistration<T>> getBeanRegistrations(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
Singleton beans for the given bean type, returning all the active registrations. Note that
this method can return multiple registrations for a given singleton bean instance since each bean may have multiple qualifiers.T - The concrete typebeanType - The bean typequalifier - The qualifier@NonNull <T> BeanRegistration<T> getBeanRegistration(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
T - The concrete typebeanType - The bean typequalifier - The qualifierNoSuchBeanException - if the bean doesn't exist@NonNull default <T> BeanRegistration<T> getBeanRegistration(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
T - The concrete typebeanType - The potentially parameterized bean typequalifier - The qualifierNoSuchBeanException - if the bean doesn't exist@NonNull <T> Optional<BeanDefinition<T>> findProxyTargetBeanDefinition(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
BeanDefinition for a ProxyBeanDefinition.T - The concrete typebeanType - The typequalifier - The qualifierOptional of the bean definitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given type@NonNull default <T> Optional<BeanDefinition<T>> findProxyTargetBeanDefinition(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
BeanDefinition for a ProxyBeanDefinition.T - The concrete typebeanType - The typequalifier - The qualifierOptional of the bean definitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given type@NonNull <T> Optional<BeanDefinition<T>> findProxyBeanDefinition(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
BeanDefinition for a ProxyBeanDefinition.T - The concrete typebeanType - The typequalifier - The qualifierOptional of the bean definitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given type@NonNull <T> Optional<BeanDefinition<T>> findProxyBeanDefinition(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
BeanDefinition for a ProxyBeanDefinition.T - The concrete typebeanType - The typequalifier - The qualifierOptional of the bean definitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given type@NonNull default <T> BeanDefinitionRegistry registerSingleton(@NonNull Class<T> type, @NonNull T singleton, @Nullable Qualifier<T> qualifier)
Registers a new singleton bean at runtime. This method expects that the bean definition data will have been compiled ahead of time.
If bean definition data is found the method will perform dependency injection on the instance followed by
invoking any PostConstruct hooks.
If no bean definition data is found the bean is registered as is.
T - The concrete typetype - The bean typesingleton - The singleton beanqualifier - The bean qualifierdefault <T> BeanDefinitionRegistry registerSingleton(@NonNull Class<T> type, @NonNull T singleton)
Registers a new singleton bean at runtime. This method expects that the bean definition data will have been compiled ahead of time.
If bean definition data is found the method will perform dependency injection on the instance followed by
invoking any PostConstruct hooks.
If no bean definition data is found the bean is registered as is.
T - The concrete typetype - the bean typesingleton - The singleton bean@NonNull default <T> BeanDefinition<T> getBeanDefinition(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
BeanDefinition for the given type.T - The concrete typebeanType - The typequalifier - The qualifierBeanDefinitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given typeNoSuchBeanException - If the bean cannot be found@NonNull default <T> BeanDefinition<T> getBeanDefinition(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
BeanDefinition for the given type.T - The concrete typebeanType - The potentially parameterized type typequalifier - The qualifierBeanDefinitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given typeNoSuchBeanException - If the bean cannot be found@NonNull default <T> BeanDefinition<T> getProxyTargetBeanDefinition(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
BeanDefinition for a ProxyBeanDefinition.T - The concrete typebeanType - The typequalifier - The qualifierBeanDefinitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given typeNoSuchBeanException - If the bean cannot be found@NonNull default <T> BeanDefinition<T> getProxyTargetBeanDefinition(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
BeanDefinition for a ProxyBeanDefinition.T - The concrete typebeanType - The typequalifier - The qualifierBeanDefinitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given typeNoSuchBeanException - If the bean cannot be found@NonNull default <T> BeanDefinition<T> getBeanDefinition(@NonNull Class<T> beanType)
BeanDefinition for the given type.T - The concrete typebeanType - The typeBeanDefinitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given typeNoSuchBeanException - If the bean cannot be found@NonNull default <T> BeanDefinition<T> getBeanDefinition(@NonNull Argument<T> beanType)
BeanDefinition for the given type.T - The concrete typebeanType - The typeBeanDefinitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given typeNoSuchBeanException - If the bean cannot be found@NonNull default <T> Optional<BeanDefinition<T>> findBeanDefinition(@NonNull Class<T> beanType)
BeanDefinition for the given type.T - The concrete typebeanType - The typeOptional of the bean definitionNonUniqueBeanException - When multiple possible bean definitions exist
for the given type@NonNull default BeanDefinitionRegistry registerSingleton(@NonNull Object singleton)
Registers a new singleton bean at runtime. This method expects that the bean definition data will have been compiled ahead of time.
If bean definition data is found the method will perform dependency injection on the instance followed by
invoking any PostConstruct hooks.
If no bean definition data is found the bean is registered as is.
singleton - The singleton bean@NonNull default BeanDefinitionRegistry registerSingleton(@NonNull Object singleton, boolean inject)
Registers a new singleton bean at runtime. This method expects that the bean definition data will have been compiled ahead of time.
If bean definition data is found the method will perform dependency injection on the instance followed by
invoking any PostConstruct hooks.
If no bean definition data is found the bean is registered as is.
singleton - The singleton beaninject - Whether the singleton should be injected (defaults to true)