Interface BeanDefinitionReference<T>
-
- Type Parameters:
T
- The bean type
- All Superinterfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider
,io.micronaut.core.annotation.AnnotationSource
,BeanContextConditional
,BeanType<T>
- All Known Subinterfaces:
RuntimeBeanDefinition<T>
- All Known Implementing Classes:
AbstractBeanDefinitionReference
,AbstractInitializableBeanDefinitionReference
,AbstractProviderDefinition
,ApplicationEventPublisherFactory
,BeanProviderDefinition
,JakartaProviderBeanDefinition
,JavaxProviderBeanDefinition
@Internal public interface BeanDefinitionReference<T> extends BeanType<T>
A bean definition reference provides a reference to a
BeanDefinition
thus allowing for soft loading of bean definitions without loading the actual types.This interface implements
AnnotationMetadataProvider
thus allowing the bean metadata to be introspected safely without loading the class or the annotations themselves.The actual bean will be loaded upon calling the
load()
method. Note that consumers of this interface should callisPresent()
prior to loading to ensure an error does not occurThe class can also decide whether to abort loading the definition by returning null
This interface extends the
BeanType
interface which is shared betweenBeanDefinition
and this type. In addition a reference can be enabled or disabled (seeBeanContextConditional.isEnabled(BeanContext)
)- Since:
- 1.0
- See Also:
BeanType
,BeanDefinition
,BeanContextConditional
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.String
getBeanDefinitionName()
default boolean
isConfigurationProperties()
default boolean
isContextScope()
boolean
isPresent()
default boolean
isSingleton()
BeanDefinition<T>
load()
Loads the bean definition.default BeanDefinition<T>
load(BeanContext context)
Loads the bean definition for the currentBeanContext
.-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclared
-
Methods inherited from interface io.micronaut.inject.BeanContextConditional
isEnabled, isEnabled
-
Methods inherited from interface io.micronaut.inject.BeanType
getBeanType, getExposedTypes, getName, isCandidateBean, isContainerType, isPrimary, requiresMethodProcessing
-
-
-
-
Method Detail
-
getBeanDefinitionName
java.lang.String getBeanDefinitionName()
- Returns:
- The class name of the backing
BeanDefinition
-
load
BeanDefinition<T> load()
Loads the bean definition.- Returns:
- The loaded component definition or null if it shouldn't be loaded
-
load
default BeanDefinition<T> load(BeanContext context)
Loads the bean definition for the currentBeanContext
.- Parameters:
context
- The bean context- Returns:
- The loaded bean definition or null if it shouldn't be loaded
-
isContextScope
default boolean isContextScope()
- Returns:
- Is this class context scope
-
isPresent
boolean isPresent()
- Returns:
- Is the underlying bean type present on the classpath
-
isSingleton
default boolean isSingleton()
- Returns:
- Is this bean a singleton.
- Since:
- 2.0
-
isConfigurationProperties
default boolean isConfigurationProperties()
- Returns:
- Is this bean a configuration properties.
- Since:
- 2.0
-
-