Class TestContextAotGenerator
java.lang.Object
org.springframework.test.context.aot.TestContextAotGenerator
TestContextAotGenerator generates AOT artifacts for integration tests
that depend on support from the Spring TestContext Framework.- Since:
- 6.0
- Author:
- Sam Brannen
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJVM system property used to set thefailOnErrorflag: "spring.test.aot.processing.failOnError". -
Constructor Summary
ConstructorsConstructorDescriptionTestContextAotGenerator(GeneratedFiles generatedFiles) Create a newTestContextAotGeneratorthat uses the suppliedGeneratedFiles.TestContextAotGenerator(GeneratedFiles generatedFiles, RuntimeHints runtimeHints) TestContextAotGenerator(GeneratedFiles generatedFiles, RuntimeHints runtimeHints, boolean failOnError) Create a newTestContextAotGeneratorthat uses the suppliedGeneratedFiles,RuntimeHints, andfailOnErrorflag. -
Method Summary
Modifier and TypeMethodDescriptionfinal RuntimeHintsGet theRuntimeHintsgathered during AOT processing.voidprocessAheadOfTime(Stream<Class<?>> testClasses) Process each of the supplied Spring integration test classes and generate AOT artifacts.
-
Field Details
-
FAIL_ON_ERROR_PROPERTY_NAME
JVM system property used to set thefailOnErrorflag: "spring.test.aot.processing.failOnError".The
failOnErrorflag controls whether errors encountered during AOT processing in the Spring TestContext Framework should result in an exception that fails the overall process.Defaults to
true.Supported values include
trueorfalse, ignoring case. For example, the default may be changed tofalseby supplying the following JVM system property via the command line.-Dspring.test.aot.processing.failOnError=false
May alternatively be configured via the
SpringPropertiesmechanism.- Since:
- 6.1
- See Also:
-
-
Constructor Details
-
TestContextAotGenerator
Create a newTestContextAotGeneratorthat uses the suppliedGeneratedFiles.- Parameters:
generatedFiles- theGeneratedFilesto use- See Also:
-
TestContextAotGenerator
Create a newTestContextAotGeneratorthat uses the suppliedGeneratedFilesandRuntimeHints.This constructor looks up the value of the
failOnErrorflag via the "spring.test.aot.processing.failOnError" property, defaulting totrueif the property is not set.- Parameters:
generatedFiles- theGeneratedFilesto useruntimeHints- theRuntimeHintsto use- See Also:
-
TestContextAotGenerator
public TestContextAotGenerator(GeneratedFiles generatedFiles, RuntimeHints runtimeHints, boolean failOnError) Create a newTestContextAotGeneratorthat uses the suppliedGeneratedFiles,RuntimeHints, andfailOnErrorflag.- Parameters:
generatedFiles- theGeneratedFilesto useruntimeHints- theRuntimeHintsto usefailOnError-trueif errors encountered during AOT processing should result in an exception that fails the overall process- Since:
- 6.1
-
-
Method Details
-
getRuntimeHints
Get theRuntimeHintsgathered during AOT processing. -
processAheadOfTime
Process each of the supplied Spring integration test classes and generate AOT artifacts.- Throws:
TestContextAotException- if an error occurs during AOT processing
-