This commit harmonizes the package space by moving the TestCompiler
infrastructure from the now outdated "generator" package to "generate".
Closes gh-29082
SqlScriptsTestExecutionListener now implements AotTestExecutionListener
in order to register run-time hints for SQL scripts used by test
classes and test methods annotated with @Sql if the configured or
detected SQL scripts are classpath resources.
Closes gh-29027
This commit introduces an AotTestExecutionListener API that extends
TestExecutionListener and allows a TestExecutionListener to opt in for
AOT processing support, analogous to what the AotContextLoader API does
for a SmartContextLoader.
Closes gh-29070
We no longer register reflection run-time hints for the SpringExtension
since that is covered by the JupiterConfigProvider in the GraalVM Native
Build Tools project.
This commit introduces automatic registration of runtime hints for
custom ActiveProfilesResolver implementations configured via the
`resolver` attribute in @ActiveProfiles.
Closes gh-29022
This commit introduces StandardTestRuntimeHints and migrates existing
hint registration from TestContextAotGenerator to this new class.
In addition, this commit removes a package cycle between context.aot and
context.web that was introduced in commit dc7c7ac22a.
See gh-29026, gh-29069
Although RuntimeHintsRegistrar can be implemented to register general
hints that should be applied for all testing infrastructure, certain
use cases require access to test classes and the
MergedContextConfiguration in order to register appropriate hints.
To address that, this commit introduces TestRuntimeHintsRegistrar as a
companion to the core RuntimeHintsRegistrar.
Closes gh-29069
This commit introduces automatic registration of a runtime hint for
classpath resources configured via the `value` attribute in
@WebAppConfiguration.
Closes gh-29026
This commit introduces automatic registration of runtime hints for
classpath resources configured via the `locations` attribute in
@TestPropertySource as well as for detected default properties files.
Closes gh-29025
This commit introduces automatic registration of runtime hints for
classpath resources configured via the `locations` attribute in
@ContextConfiguration.
Closes gh-29021
This commit automatically registers runtime hints for
TestContextBootstrapper classes, including default bootstrappers as
well as any bootstrapper configured via @BootstrapWith.
Closes gh-29023
This commit introduces automatic registration of runtime hints for
ApplicationContextInitializers configured via the `initializers`
attribute in @ContextConfiguration.
See gh-29021
This commit moves the registration of runtime hints for ContextLoaders
from TestContextRuntimeHints to TestContextAotGenerator.
This allows for automatic registration of any ContextLoader used,
including custom loaders declared via the `loader` attribute in
@ContextConfiguration.
See gh-29021
Since Spring no longer adds the SynthesizedAnnotation interface to the
JDK dynamic proxy used to synthesize an annotation, this commit
officially deprecates SynthesizedAnnotation and related methods in
RuntimeHintsUtils.
See gh-29041, gh-29054
Closes gh-29053
This commit introduces TestContextRuntimeHints which is a
RuntimeHintsRegistrar implementation that makes core types and
annotations from the Spring TestContext Framework available at runtime
within a GraalVM native image.
TestContextRuntimeHints is registered automatically via the
"META-INF/spring/aot.factories" file in spring-test.
This commit also modifies TestContextAotGeneratorTests to assert the
expected runtime hints registered by TestContextRuntimeHints as well as
runtime hints for TestExecutionListener and ContextCustomizerFactory
implementations registered by SpringFactoriesLoaderRuntimeHints.
Closes gh-29028
Closes gh-29044
Prior to this commit, MockServerContainerContextCustomizerFactory did
not find @WebAppConfiguration on an enclosing class and therefore
failed to create a MockServerContainerContextCustomizer for a @Nested
test class.
This commit addresses this by using TestContextAnnotationUtils to
determine if the test class is "annotated" with @WebAppConfiguration.
Closes gh-29037
Since MockServerContainerContextCustomizerFactory already has a
`webSocketPresent` check, there should be no need to instantiate
MockServerContainerContextCustomizer via reflection.
See gh-29028
Closes gh-29035
With this commit, if a ContextCustomizerFactory cannot be loaded due to
a ClassNotFoundException or NoClassDefFoundError, we skip it and log a
DEBUG message.
This aligns with the "skipping" logic already in place for
TestExecutionListeners.
Closes gh-29034
With this commit we now log an identical message (without a stack
trace) for a TestExecutionListener skipped due to a
ClassNotFoundException like we already do for a listener skipped due to
a NoClassDefFoundError.
Prior to this commit, we logged which default TestExecutionListeners
were discovered and which listeners were used, but we did not log
anything for ContextCustomizerFactory and ContextCustomizer.
This commit therefore introduces similar logging for
ContextCustomizerFactory and ContextCustomizer to improve diagnostics.
Closes gh-29036
This commit makes TestClassScanner and TestContextAotGenerator public so
that the Spring Boot team can take over implementation of the
TestAotProcessor to integrate it into the AOT and native build plugins.
This commit introduces support for Netty 5's Buffer, in the form of
Netty5DataBuffer. Because of the new API offered by Buffer, several
changes have been made to the DataBuffer API:
- CloseableDataBuffer is a simpler alternative to PooledDataBuffer, and
implemented by Netty5DataBuffer. DataBufferUtils::release can now
handle CloseableDataBuffer as well as PooledDataBuffer.
- PooledDataBuffer::touch has been moved into a separate interface:
TouchableDataBuffer, which is implemented by Netty5DataBuffer.
- The capacity of DataBuffers can no longer be reduced, they can only
grow larger. As a consequence, DataBuffer::capacity(int) has been
deprecated, but ensureWritable (formally ensureCapacity) still exists.
- DataBuffer::slice and retainedSlice have been deprecated in favor of
split, a new method that ensures that memory regions do not overlap.
- DataBuffer::asByteBuffer has been deprecated in favor of toByteBuffer,
a new method that returns a copy, instead of shared data.
- DataBufferFactory::allocateBuffer has been deprecated in favor of
allocateBuffer(int).
Closes gh-28874
This commit introduces TestAotProcessor which replaces
ProcessTestsAheadOfTimeCommand, removes the dependency on picocli, and
aligns with the implementation of the AotProcessor in Spring Boot.
TestAotProcessor is a command-line application (CLI) that scans the
provided classpath roots for Spring integration test classes and then
generates AOT artifacts for those test classes in the provided output
directories.
This CLI is only intended to be used by build tools.
Closes gh-28825