Package org.springframework.context.aot
Class ContextAotProcessor
java.lang.Object
org.springframework.context.aot.AbstractAotProcessor
org.springframework.context.aot.ContextAotProcessor
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.
- Since:
- 6.0
- Author:
- Stephane Nicoll, Andy Wilkinson, Phillip Webb, Sam Brannen
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.context.aot.AbstractAotProcessor
AbstractAotProcessor.Settings
-
Constructor Summary
ModifierConstructorDescriptionprotected
ContextAotProcessor
(Class<?> applicationClass, AbstractAotProcessor.Settings settings) Create a new processor for the specified application entry point and common settings. -
Method Summary
Modifier and TypeMethodDescriptionprotected ClassNameGenerator
Callback to customize theClassNameGenerator
.protected Class<?>
Get the the application entry point (typically a class with amain()
method).getDefaultNativeImageArguments
(String applicationClassName) Return the native image arguments to use.protected org.springframework.javapoet.ClassName
performAotProcessing
(GenericApplicationContext applicationContext) Perform ahead-of-time processing of the specified context.protected abstract GenericApplicationContext
prepareApplicationContext
(Class<?> applicationClass) Prepare theGenericApplicationContext
for the specified application entry point to be used against anApplicationContextAotGenerator
.org.springframework.javapoet.ClassName
process()
Invoke the processing by clearing output directories first, followed byperformAotProcessing(GenericApplicationContext)
.Methods inherited from class org.springframework.context.aot.AbstractAotProcessor
createFileSystemGeneratedFiles, deleteExistingOutput, getSettings, writeHints
-
Constructor Details
-
ContextAotProcessor
Create a new processor for the specified application entry point and common settings.- Parameters:
applicationClass
- the application entry point (class with amain()
method)settings
- the settings to apply
-
-
Method Details
-
getApplicationClass
Get the the application entry point (typically a class with amain()
method). -
process
public org.springframework.javapoet.ClassName process()Invoke the processing by clearing output directories first, followed byperformAotProcessing(GenericApplicationContext)
.- Returns:
- the
ClassName
of theApplicationContextInitializer
entry point
-
prepareApplicationContext
Prepare theGenericApplicationContext
for the specified application entry point to be used against anApplicationContextAotGenerator
.- Returns:
- 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.
- Parameters:
applicationContext
- the context to process
-
createClassNameGenerator
Callback to customize theClassNameGenerator
.By default, a standard
ClassNameGenerator
using the configured application entry point as the default target is used.- Returns:
- the class name generator
-
getDefaultNativeImageArguments
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
native-image.properties
is contributed.- Parameters:
applicationClassName
- the fully qualified class name of the application entry point- Returns:
- the native image options to contribute
-