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 Summary
ConstructorsConstructorDescriptionInstanceSupplierCodeGenerator(GenerationContext generationContext, org.springframework.javapoet.ClassName className, GeneratedMethods generatedMethods, boolean allowDirectSupplierShortcut) Create a new generator instance. - 
Method Summary
Modifier 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
- 
InstanceSupplierCodeGenerator
public InstanceSupplierCodeGenerator(GenerationContext generationContext, org.springframework.javapoet.ClassName className, GeneratedMethods generatedMethods, boolean allowDirectSupplierShortcut) Create a new generator instance.- Parameters:
 generationContext- the generation contextclassName- the class name of the bean to instantiategeneratedMethods- the generated methodsallowDirectSupplierShortcut- whether a direct supplier may be used rather than always needing anInstanceSupplier
 
 - 
 - 
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 handleconstructorOrFactoryMethod- the executable to use to create the bean- Returns:
 - the generated code
 
 - 
generateCode
public org.springframework.javapoet.CodeBlock generateCode(RegisteredBean registeredBean, RegisteredBean.InstantiationDescriptor instantiationDescriptor) Generate the instance supplier code.- Parameters:
 registeredBean- the bean to handleinstantiationDescriptor- the executable to use to create the bean- Returns:
 - the generated code
 - Since:
 - 6.1.7
 
 
 - 
 
generateCode(RegisteredBean, InstantiationDescriptor)