Class InstanceSupplierCodeGenerator
java.lang.Object
org.springframework.beans.factory.aot.InstanceSupplierCodeGenerator
Default code generator to create an 
InstanceSupplier, usually in
 the form of a BeanInstanceSupplier that retains the executable
 that is used to instantiate the bean. Takes care of registering the
 necessary hints if reflection or a JDK proxy is required.
 Generated code is usually a method reference that generates the
 BeanInstanceSupplier, but some shortcut can be used as well such as:
 
InstanceSupplier.of(TheGeneratedClass::getMyBeanInstance);
- Since:
- 6.0
- Author:
- Phillip Webb, Stephane Nicoll, Juergen Hoeller, Sebastien Deleuze
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionInstanceSupplierCodeGenerator(GenerationContext generationContext, org.springframework.javapoet.ClassName className, GeneratedMethods generatedMethods, boolean allowDirectSupplierShortcut) Create a new generator instance.
- 
Method SummaryModifier and TypeMethodDescriptionorg.springframework.javapoet.CodeBlockgenerateCode(RegisteredBean registeredBean, Executable constructorOrFactoryMethod) Deprecated.org.springframework.javapoet.CodeBlockgenerateCode(RegisteredBean registeredBean, RegisteredBean.InstantiationDescriptor instantiationDescriptor) Generate the instance supplier code.
- 
Constructor Details- 
InstanceSupplierCodeGeneratorpublic InstanceSupplierCodeGenerator(GenerationContext generationContext, org.springframework.javapoet.ClassName className, GeneratedMethods generatedMethods, boolean allowDirectSupplierShortcut) Create a new generator instance.- Parameters:
- generationContext- the generation context
- className- the class name of the bean to instantiate
- generatedMethods- the generated methods
- allowDirectSupplierShortcut- whether a direct supplier may be used rather than always needing an- InstanceSupplier
 
 
- 
- 
Method Details- 
generateCode@Deprecated(since="6.1.7") public org.springframework.javapoet.CodeBlock generateCode(RegisteredBean registeredBean, Executable constructorOrFactoryMethod) Deprecated.Generate the instance supplier code.- Parameters:
- registeredBean- the bean to handle
- constructorOrFactoryMethod- the executable to use to create the bean
- Returns:
- the generated code
 
- 
generateCodepublic org.springframework.javapoet.CodeBlock generateCode(RegisteredBean registeredBean, RegisteredBean.InstantiationDescriptor instantiationDescriptor) Generate the instance supplier code.- Parameters:
- registeredBean- the bean to handle
- instantiationDescriptor- the executable to use to create the bean
- Returns:
- the generated code
- Since:
- 6.1.7
 
 
- 
generateCode(RegisteredBean, InstantiationDescriptor)