Class ContextAotProcessor


public abstract class ContextAotProcessor extends AbstractAotProcessor<org.springframework.javapoet.ClassName>
Filesystem-based ahead-of-time (AOT) processing base implementation.

Concrete implementations are typically used to kick off optimization of an application in a build tool.

Stephane Nicoll, Andy Wilkinson, Phillip Webb, Sam Brannen
See Also:
  • Constructor Details

    • ContextAotProcessor

      protected ContextAotProcessor(Class<?> applicationClass, AbstractAotProcessor.Settings settings)
      Create a new processor for the specified application entry point and common settings.
      applicationClass - the application entry point (class with a main() method)
      settings - the settings to apply
  • Method Details

    • getApplicationClass

      protected Class<?> getApplicationClass()
      Get the application entry point (typically a class with a main() method).
    • doProcess

      protected org.springframework.javapoet.ClassName doProcess()
      Invoke the processing by clearing output directories first, followed by performAotProcessing(GenericApplicationContext).
      Specified by:
      doProcess in class AbstractAotProcessor<org.springframework.javapoet.ClassName>
      the ClassName of the ApplicationContextInitializer entry point
    • prepareApplicationContext

      protected abstract GenericApplicationContext prepareApplicationContext(Class<?> applicationClass)
      Prepare the GenericApplicationContext for the specified application entry point to be used against an ApplicationContextAotGenerator.
      a non-refreshed GenericApplicationContext
    • performAotProcessing

      protected org.springframework.javapoet.ClassName performAotProcessing(GenericApplicationContext applicationContext)
      Perform ahead-of-time processing of the specified context.

      Code, resources, and generated classes are stored in the configured output directories. In addition, run-time hints are registered for the application and its entry point.

      applicationContext - the context to process
    • createClassNameGenerator

      protected ClassNameGenerator createClassNameGenerator()
      Callback to customize the ClassNameGenerator.

      By default, a standard ClassNameGenerator using the configured application entry point as the default target is used.

      the class name generator
    • getDefaultNativeImageArguments

      protected List<String> getDefaultNativeImageArguments(String applicationClassName)
      Return the native image arguments to use.

      By default, the main class to use, as well as standard application flags are added.

      If the returned list is empty, no is contributed.

      applicationClassName - the fully qualified class name of the application entry point
      the native image options to contribute