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
ConstructorsConstructorDescriptionBeanRegistrationBeanFactoryContribution(String beanName, RootBeanDefinition beanDefinition, BeanInstantiationGenerator beanInstantiationGenerator) -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyTo(BeanFactoryInitialization initialization) Contribute ahead of time optimizations to the specificBeanFactoryInitialization.protected CodeContributiongenerateBeanInstance(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.CodeBlockprotected booleanshouldDeclareCreator(Executable instanceCreator) Specify if the creatorExecutableshould be defined.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:BeanFactoryContributionContribute ahead of time optimizations to the specificBeanFactoryInitialization.- Specified by:
applyToin interfaceBeanFactoryContribution- Parameters:
initialization-BeanFactoryInitializationto contribute to
-
getAttributeFilter
Return the predicate to use to include Bean Definitionattributes.- Returns:
- the bean definition's attributes include filter
-
shouldDeclareCreator
Specify if the creatorExecutableshould be defined. By default, a creator is specified if theinstanceSuppliercallback is used with aninstanceContextcallback.- Parameters:
instanceCreator- the executable to use to instantiate the bean- Returns:
trueto declare the creator
-
generateBeanInstance
Return the necessary code to instantiate and post-process a bean.- Parameters:
runtimeHints- theRuntimeHintsto use- Returns:
- a code contribution that provides an initialized bean instance
-
initializeBeanDefinitionRegistrar
protected org.springframework.javapoet.CodeBlock initializeBeanDefinitionRegistrar()
-