public interface BeanDefinitionRegistry
Core bean definition registry interface containing methods to find BeanDefinition
instances.
Modifier and Type | Method and Description |
---|---|
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(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(Class<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(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 . |
<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. |
<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. |
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 bean@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 <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 <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 Collection<BeanDefinition<?>> getBeanDefinitions(@Nonnull Qualifier<Object> qualifier)
BeanDefinition
for the given qualifier.qualifier
- The qualifer@Nonnull Collection<BeanDefinition<?>> getAllBeanDefinitions()
BeanDefinition
.@Nonnull Collection<BeanDefinitionReference<?>> getBeanDefinitionReferences()
BeanDefinitionReference
.@Nonnull Collection<BeanRegistration<?>> getActiveBeanRegistrations(@Nonnull Qualifier<?> qualifier)
Singleton
beans for the given qualifier.qualifier
- The qualifier@Nonnull <T> Collection<BeanRegistration<T>> getActiveBeanRegistrations(@Nonnull Class<T> beanType)
Singleton
beans for the given bean type.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.T
- The concrete typebeanType
- The bean type@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 <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 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 qualifierBeanDefinition
NonUniqueBeanException
- 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 qualifierBeanDefinition
NonUniqueBeanException
- 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 typeBeanDefinition
NonUniqueBeanException
- 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)