Class InjectionGenerator
java.lang.Object
org.springframework.beans.factory.generator.InjectionGenerator
Generate the necessary code to
create a bean instance
or inject dependencies
.
The generator assumes a number of variables to be accessible:
beanFactory
: the generalDefaultListableBeanFactory
instanceContext
: theBeanDefinitionRegistrar.BeanInstanceContext
callbackbean
: the variable that refers to the bean instance
- Author:
- Stephane Nicoll, Brian Clozel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.javapoet.CodeBlock
generateInjection
(Member member, boolean required) Generate the code to inject a value resolved byBeanDefinitionRegistrar.BeanInstanceContext
in the specifiedMember
.org.springframework.javapoet.CodeBlock
generateInstantiation
(Executable creator) Generate the necessary code to instantiate an object using the specifiedExecutable
.Return theProtectedAccess.Options
to use if protected access analysis is required for the specifiedMember
.
-
Constructor Details
-
InjectionGenerator
public InjectionGenerator()
-
-
Method Details
-
generateInstantiation
Generate the necessary code to instantiate an object using the specifiedExecutable
. The code is suitable to be assigned to a variable or used as a return statement.- Parameters:
creator
- the executable to invoke to create an instance of the requested object- Returns:
- the code to instantiate an object using the specified executable
-
generateInjection
Generate the code to inject a value resolved byBeanDefinitionRegistrar.BeanInstanceContext
in the specifiedMember
.- Parameters:
member
- the field or method to injectrequired
- whether the value is required- Returns:
- a statement that injects a value to the specified member
- See Also:
-
getProtectedAccessInjectionOptions
Return theProtectedAccess.Options
to use if protected access analysis is required for the specifiedMember
.- Parameters:
member
- the field or method to handle- Returns:
- the options to use to analyse protected access
- See Also:
-