Interface BeanDefinitionReference<T>
- Type Parameters:
T
- The bean type
- All Superinterfaces:
AnnotationMetadata
,AnnotationMetadataDelegate
,AnnotationMetadataProvider
,AnnotationSource
,ArgumentCoercible<T>
,BeanContextConditional
,BeanInfo<T>
,BeanType<T>
,QualifiedBeanType<T>
- All Known Subinterfaces:
RuntimeBeanDefinition<T>
- All Known Implementing Classes:
AbstractInitializableBeanDefinitionReference
,AbstractProviderDefinition
,ApplicationEventPublisherFactory
,BeanProviderDefinition
,DisabledBean
,InterceptorRegistryBean
,JakartaProviderBeanDefinition
,JavaxProviderBeanDefinition
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 call isPresent()
prior to loading to ensure an error does not occur
The class can also decide whether to abort loading the definition by returning null
This interface extends the BeanType
interface which is shared between BeanDefinition
and this type. In addition a
reference can be enabled or disabled (see BeanContextConditional.isEnabled(BeanContext)
)
- Since:
- 1.0
- Author:
- Graeme Rocher
- See Also:
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
default boolean
boolean
default boolean
Returns whether another bean exists that proxies this bean.default boolean
default boolean
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.AnnotationMetadata
enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasEvaluatedExpressions, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresent
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, copyAnnotationMetadata, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByName, getAnnotationValuesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByName, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getTargetAnnotationMetadata, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasPropertyExpressions, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
getAnnotationMetadata
Methods inherited from interface io.micronaut.inject.BeanContextConditional
isEnabled, isEnabled
Methods inherited from interface io.micronaut.core.beans.BeanInfo
asArgument, getGenericBeanType
Methods inherited from interface io.micronaut.inject.BeanType
getBeanName, getBeanType, getExposedTypes, getName, isCandidateBean, isContainerType, isPrimary, requiresMethodProcessing
Methods inherited from interface io.micronaut.inject.QualifiedBeanType
getDeclaredQualifier, resolveDynamicQualifier
-
Method Details
-
getBeanDefinitionName
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
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
-
isProxiedBean
default boolean isProxiedBean()Returns whether another bean exists that proxies this bean. In other words this bean is the target of a proxy.- Returns:
- Is the reference a proxy target.
- Since:
- 4.0.0
-
isProxyTarget
default boolean isProxyTarget()- Returns:
- Whether this reference is a proxy target.
-