Class TestContextAotGenerator

java.lang.Object
org.springframework.test.context.aot.TestContextAotGenerator

public class TestContextAotGenerator extends Object
TestContextAotGenerator generates AOT artifacts for integration tests that depend on support from the Spring TestContext Framework.
Since:
6.0
Author:
Sam Brannen
See Also:
  • ApplicationContextAotGenerator
  • Field Details

    • FAIL_ON_ERROR_PROPERTY_NAME

      public static final String FAIL_ON_ERROR_PROPERTY_NAME
      JVM system property used to set the failOnError flag: "spring.test.aot.processing.failOnError".

      The failOnError flag 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 true or false, ignoring case. For example, the default may be changed to false by supplying the following JVM system property via the command line.

      -Dspring.test.aot.processing.failOnError=false

      May alternatively be configured via the SpringProperties mechanism.

      Since:
      6.1
      See Also:
  • Constructor Details

    • TestContextAotGenerator

      public TestContextAotGenerator(org.springframework.aot.generate.GeneratedFiles generatedFiles)
      Create a new TestContextAotGenerator that uses the supplied GeneratedFiles.
      Parameters:
      generatedFiles - the GeneratedFiles to use
      See Also:
    • TestContextAotGenerator

      public TestContextAotGenerator(org.springframework.aot.generate.GeneratedFiles generatedFiles, org.springframework.aot.hint.RuntimeHints runtimeHints)
      Create a new TestContextAotGenerator that uses the supplied GeneratedFiles and RuntimeHints.

      This constructor looks up the value of the failOnError flag via the "spring.test.aot.processing.failOnError" property, defaulting to true if the property is not set.

      Parameters:
      generatedFiles - the GeneratedFiles to use
      runtimeHints - the RuntimeHints to use
      See Also:
    • TestContextAotGenerator

      public TestContextAotGenerator(org.springframework.aot.generate.GeneratedFiles generatedFiles, org.springframework.aot.hint.RuntimeHints runtimeHints, boolean failOnError)
      Create a new TestContextAotGenerator that uses the supplied GeneratedFiles, RuntimeHints, and failOnError flag.
      Parameters:
      generatedFiles - the GeneratedFiles to use
      runtimeHints - the RuntimeHints to use
      failOnError - true if errors encountered during AOT processing should result in an exception that fails the overall process
      Since:
      6.1
  • Method Details

    • getRuntimeHints

      public final org.springframework.aot.hint.RuntimeHints getRuntimeHints()
      Get the RuntimeHints gathered during AOT processing.
    • processAheadOfTime

      public void processAheadOfTime(Stream<Class<?>> testClasses) throws TestContextAotException
      Process each of the supplied Spring integration test classes and generate AOT artifacts.
      Throws:
      TestContextAotException - if an error occurs during AOT processing