After AOT processing, a WebTestClient bean will be defined directly
so the context customizer that initiates its registration is not
needed.
Closes gh-32859
After AOT processing, a TestRestTemplate bean will be defined
directly so the context customizer that initiates its registration is
not needed. We'd already disabled the registrar but this is
insufficient in Graal 22.3 which fails fast when the customizer tries
to reference the registrar.
Fixes gh-32848
Update `OutputCapture` so that expensive build operations are only
performed when necessary. This update is especially important for Kotlin
users calling `"Expected String" in output` since this results in a call
to Kotlin's `CharSequence.contains` which calls the `length()` and
`charAt()` methods many times.
Closes gh-32033
This commit adapts the `TestRestTemplate` implementation to the
httpclient5 API since httpclient 4.x is now unsupported in Spring
Framework.
See gh-32461
As htttpclient 4.x is not supported anymore by `RestTemplate`, this
commit changes such dependencies to httpclient5 instead. In some cases,
the httpclient 4.x was transitively brought by a non-Spring dependency.
See gh-32461
This commit disables ContextCustomizer implementations that tune a
test configuration context at runtime. Previously, these ran again and
required additional hints to work properly.
Rather than contributing those hints, the customizer is skipped as its
impact is irrelevant in an AOT-optimized context: the context is fully
prepared and the updates on the MergedContextConfiguration are not taken
into account.
Closes gh-32422
Update `SpringBootContextLoader` so that it now implements the
`AotContextLoader` interface. The `ContextLoaderHook` will abandon
at `contextLoaded` if the test class is being AOT processed.
This commit also introduces a new `AotApplicationContextInitializer`
which allows us to plug-in an alternative AOT application context
listener when the `SpringApplication` is running in test mode.
Closes gh-31965
Add a new `useMainMethod` attribute to `SpringBootTest` which can be
used to determine how the test should run. The three available options
are:
- `ALWAYS`
- `NEVER`
- `WHEN_AVAILABLE`
The default is `WHEN_AVAILABLE` which will attempt to launch the test
using the `main` method if there is one.
The `SpringBootContextLoader` has been updated to use the new
`SpringApplicationHook` interface when the main method is being used.
Closes gh-22405
This commit adds the Spring for GraphQL auto-configuration back
into Spring Boot 3.0, now that a 1.1.0 release is scheduled with the
required baseline. This release also needs GraphQL Java 19.0 as a
baseline.
Closes gh-31809
Add `AbstractApplicationContextRunner.prepare` which can be used to
test an `ApplicationContext` that has been prepared but not refreshed.
Closes gh-31302
Previously, classes were registered first which meant that their
conditions were evaluated before any initializers and bean
registrations were applied. This prevented the bean registrations and
initializers from affecting the outcome of the condition evaluation.
This commit inverts the ordering so that classes are not registerd,
and therefore their conditions are not evaluated, until after the
bean registrations and initializers have been applied.
Closes gh-31280