T - The bean typepublic interface RuntimeBeanDefinition<T> extends BeanDefinitionReference<T>, BeanDefinition<T>, BeanFactory<T>, BeanContextConditional
BeanDefinitionRegistry at runtime.
This differs from BeanDefinitionRegistry.registerSingleton(Object) in that
beans registered this way can be created lazily or not at all and participate
more completely in the life cycle of the BeanContext (for examples event listeners like BeanCreatedEventListener will be fired).
Note that it is generally not recommended to use this approach and build time bean computation is preferred. This type is designed to support a few limited use cases where runtime bean registration is required.
BeanDefinitionRegistry.registerBeanDefinition(RuntimeBeanDefinition)| Modifier and Type | Interface and Description |
|---|---|
static interface |
RuntimeBeanDefinition.Builder<B>
A builder for constructing
RuntimeBeanDefinition instances. |
NAMED_ATTRIBUTECLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBEREMPTY| Modifier and Type | Method and Description |
|---|---|
static <B> RuntimeBeanDefinition.Builder<B> |
builder(Argument<B> beanType,
Supplier<B> beanSupplier)
A new builder for constructing and configuring runtime created beans.
|
static <B> RuntimeBeanDefinition.Builder<B> |
builder(B bean)
A new builder for constructing and configuring runtime created beans.
|
static <B> RuntimeBeanDefinition.Builder<B> |
builder(Class<B> beanType,
Supplier<B> beanSupplier)
A new builder for constructing and configuring runtime created beans.
|
default AnnotationMetadata |
getAnnotationMetadata()
Supplies the metadata.
|
default String |
getBeanDefinitionName() |
default boolean |
isContextScope() |
default boolean |
isEnabled(BeanContext context,
BeanResolutionContext resolutionContext)
Return whether this component is enabled for the given context.
|
default boolean |
isPresent() |
default boolean |
isSingleton() |
default BeanDefinition<T> |
load()
Loads the bean definition.
|
default BeanDefinition<T> |
load(BeanContext context)
Loads the bean definition for the current
BeanContext. |
static <B> RuntimeBeanDefinition<B> |
of(B bean)
Creates a new effectively singleton bean definition that references the given bean.
|
static <B> RuntimeBeanDefinition<B> |
of(Class<B> beanType,
Supplier<B> beanSupplier)
Creates a new bean definition that will resolve the bean from the given supplier.
|
isConfigurationPropertiesasArgument, findMethod, findPossibleMethods, getBeanType, getConstructor, getContainerElement, getDeclaredQualifier, getDeclaringType, getExecutableMethods, getInjectedFields, getInjectedMethods, getName, getPostConstructMethods, getPreDestroyMethods, getRequiredComponents, getRequiredMethod, getScope, getScopeName, getTypeArguments, getTypeArguments, getTypeArguments, getTypeParameters, getTypeParameters, inject, inject, isAbstract, isCandidateBean, isIterable, isProvided, isProxy, resolveDynamicQualifierbooleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, 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, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, 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, synthesizeDeclaredAnnotationsByTypegetAnnotationValuesByName, getAnnotationValuesByStereotype, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresentgetExposedTypes, isContainerType, isPrimary, requiresMethodProcessingisEnabledbuild, build@NonNull default AnnotationMetadata getAnnotationMetadata()
AnnotationMetadataProviderAnnotationMetadata.EMPTY_METADATA.getAnnotationMetadata in interface AnnotationMetadataProviderAnnotationMetadatadefault boolean isEnabled(@NonNull BeanContext context, BeanResolutionContext resolutionContext)
BeanContextConditionalisEnabled in interface BeanContextConditionalcontext - The contextresolutionContext - The bean resolution contextdefault boolean isContextScope()
isContextScope in interface BeanDefinitionReference<T>default BeanDefinition<T> load()
BeanDefinitionReferenceload in interface BeanDefinitionReference<T>default String getBeanDefinitionName()
getBeanDefinitionName in interface BeanDefinitionReference<T>BeanDefinitiondefault BeanDefinition<T> load(BeanContext context)
BeanDefinitionReferenceBeanContext.load in interface BeanDefinitionReference<T>context - The bean contextdefault boolean isPresent()
isPresent in interface BeanDefinitionReference<T>default boolean isSingleton()
isSingleton in interface BeanDefinition<T>isSingleton in interface BeanDefinitionReference<T>@NonNull static <B> RuntimeBeanDefinition<B> of(@NonNull B bean)
B - The bean typebean - The beanBeanDefinitionReference@NonNull static <B> RuntimeBeanDefinition<B> of(@NonNull Class<B> beanType, @NonNull Supplier<B> beanSupplier)
The bean is by default not singleton and the supplier will be invoked for each injection point.
B - The bean typebeanType - The bean typebeanSupplier - The bean supplierBeanDefinitionReference@NonNull static <B> RuntimeBeanDefinition.Builder<B> builder(@NonNull B bean)
B - The bean typebean - The bean to use@NonNull static <B> RuntimeBeanDefinition.Builder<B> builder(@NonNull Class<B> beanType, @NonNull Supplier<B> beanSupplier)
B - The bean typebeanType - The bean typebeanSupplier - The bean supplier@NonNull static <B> RuntimeBeanDefinition.Builder<B> builder(@NonNull Argument<B> beanType, @NonNull Supplier<B> beanSupplier)
B - The bean typebeanType - The bean typebeanSupplier - The bean supplier