Class BeanFactoryInitialization
java.lang.Object
org.springframework.beans.factory.generator.BeanFactoryInitialization
- Direct Known Subclasses:
ApplicationContextInitialization
The initialization of a
BeanFactory
.- Since:
- 6.0
- Author:
- Andy Wilkinson, Stephane Nicoll
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
contribute
(Consumer<org.springframework.javapoet.CodeBlock.Builder> code) Contribute code that initializes the bean factory and that does not require any privileged access.void
contribute
(ProtectedAccess protectedAccess, Supplier<String> methodName, Consumer<org.springframework.javapoet.CodeBlock.Builder> methodBody) Contribute code that initializes the bean factory.Return theGeneratedTypeContext
to use to contribute additional methods or hints.org.springframework.javapoet.CodeBlock
Return the code that has been contributed to this instance.
-
Constructor Details
-
BeanFactoryInitialization
-
-
Method Details
-
generatedTypeContext
Return theGeneratedTypeContext
to use to contribute additional methods or hints.- Returns:
- the generation context
-
contribute
Contribute code that initializes the bean factory and that does not require any privileged access.- Parameters:
code
- the code to contribute
-
contribute
public void contribute(ProtectedAccess protectedAccess, Supplier<String> methodName, Consumer<org.springframework.javapoet.CodeBlock.Builder> methodBody) Contribute code that initializes the bean factory. If privileged access is required, a public method in the target package is created and invoked, rather than contributing the code directly.- Parameters:
protectedAccess
- theProtectedAccess
instance to usemethodName
- a method name to use if privileged access is requiredmethodBody
- the contribution
-
toCodeBlock
public org.springframework.javapoet.CodeBlock toCodeBlock()Return the code that has been contributed to this instance.- Returns:
- the code
-