Class BeanFactoryInitialization

java.lang.Object
org.springframework.beans.factory.generator.BeanFactoryInitialization
Direct Known Subclasses:
ApplicationContextInitialization

public class BeanFactoryInitialization extends Object
The initialization of a BeanFactory.
Since:
6.0
Author:
Andy Wilkinson, Stephane Nicoll
  • Constructor Details

    • BeanFactoryInitialization

      public BeanFactoryInitialization(GeneratedTypeContext generatedTypeContext)
  • Method Details

    • generatedTypeContext

      public GeneratedTypeContext generatedTypeContext()
      Return the GeneratedTypeContext to use to contribute additional methods or hints.
      Returns:
      the generation context
    • contribute

      public void contribute(Consumer<org.springframework.javapoet.CodeBlock.Builder> code)
      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 - the ProtectedAccess instance to use
      methodName - a method name to use if privileged access is required
      methodBody - the contribution
    • toCodeBlock

      public org.springframework.javapoet.CodeBlock toCodeBlock()
      Return the code that has been contributed to this instance.
      Returns:
      the code