Class BeanRegistrationBeanFactoryContribution
java.lang.Object
org.springframework.beans.factory.generator.BeanRegistrationBeanFactoryContribution
- All Implemented Interfaces:
BeanFactoryContribution
public class BeanRegistrationBeanFactoryContribution
extends Object
implements BeanFactoryContribution
A
BeanFactoryContribution
that registers a bean with the bean
factory.- Since:
- 6.0
- Author:
- Stephane Nicoll
-
Constructor Summary
ConstructorDescriptionBeanRegistrationBeanFactoryContribution
(String beanName, RootBeanDefinition beanDefinition, BeanInstantiationGenerator beanInstantiationGenerator) -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyTo
(BeanFactoryInitialization initialization) Contribute ahead of time optimizations to the specificBeanFactoryInitialization
.protected CodeContribution
generateBeanInstance
(RuntimeHints runtimeHints) Return the necessary code to instantiate and post-process a bean.Return the predicate to use to include Bean Definitionattributes
.protected org.springframework.javapoet.CodeBlock
protected boolean
shouldDeclareCreator
(Executable instanceCreator) Specify if the creatorExecutable
should be defined.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.generator.BeanFactoryContribution
getBeanDefinitionExcludeFilter
-
Constructor Details
-
BeanRegistrationBeanFactoryContribution
public BeanRegistrationBeanFactoryContribution(String beanName, RootBeanDefinition beanDefinition, BeanInstantiationGenerator beanInstantiationGenerator)
-
-
Method Details
-
applyTo
Description copied from interface:BeanFactoryContribution
Contribute ahead of time optimizations to the specificBeanFactoryInitialization
.- Specified by:
applyTo
in interfaceBeanFactoryContribution
- Parameters:
initialization
-BeanFactoryInitialization
to contribute to
-
getAttributeFilter
Return the predicate to use to include Bean Definitionattributes
.- Returns:
- the bean definition's attributes include filter
-
shouldDeclareCreator
Specify if the creatorExecutable
should be defined. By default, a creator is specified if theinstanceSupplier
callback is used with aninstanceContext
callback.- Parameters:
instanceCreator
- the executable to use to instantiate the bean- Returns:
true
to declare the creator
-
generateBeanInstance
Return the necessary code to instantiate and post-process a bean.- Parameters:
runtimeHints
- theRuntimeHints
to use- Returns:
- a code contribution that provides an initialized bean instance
-
initializeBeanDefinitionRegistrar
protected org.springframework.javapoet.CodeBlock initializeBeanDefinitionRegistrar()
-