Skip to content

Commit 55d13a0

Browse files
committed
Document @⁠DisabledInAotMode & @[Enabled|Disabled]InNativeImage in ref docs
Closes gh-31437 Closes gh-31438
1 parent a207e5e commit 55d13a0

File tree

5 files changed

+32
-0
lines changed

5 files changed

+32
-0
lines changed

framework-docs/modules/ROOT/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@
182182
***** xref:testing/annotations/integration-spring/annotation-sqlconfig.adoc[]
183183
***** xref:testing/annotations/integration-spring/annotation-sqlmergemode.adoc[]
184184
***** xref:testing/annotations/integration-spring/annotation-sqlgroup.adoc[]
185+
***** xref:testing/annotations/integration-spring/annotation-disabledinaotmode.adoc[]
185186
**** xref:testing/annotations/integration-junit4.adoc[]
186187
**** xref:testing/annotations/integration-junit-jupiter.adoc[]
187188
**** xref:testing/annotations/integration-meta.adoc[]

framework-docs/modules/ROOT/pages/testing/annotations/integration-junit-jupiter.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupite
1111
* xref:testing/annotations/integration-junit-jupiter.adoc#integration-testing-annotations-nestedtestconfiguration[`@NestedTestConfiguration`]
1212
* xref:testing/annotations/integration-junit-jupiter.adoc#integration-testing-annotations-junit-jupiter-enabledif[`@EnabledIf`]
1313
* xref:testing/annotations/integration-junit-jupiter.adoc#integration-testing-annotations-junit-jupiter-disabledif[`@DisabledIf`]
14+
* xref:testing/annotations/integration-spring/annotation-disabledinaotmode.adoc[`@DisabledInAotMode`]
1415

1516
[[integration-testing-annotations-junit-jupiter-springjunitconfig]]
1617
== `@SpringJUnitConfig`

framework-docs/modules/ROOT/pages/testing/annotations/integration-spring.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ Spring's testing annotations include the following:
2727
* xref:testing/annotations/integration-spring/annotation-sqlconfig.adoc[`@SqlConfig`]
2828
* xref:testing/annotations/integration-spring/annotation-sqlmergemode.adoc[`@SqlMergeMode`]
2929
* xref:testing/annotations/integration-spring/annotation-sqlgroup.adoc[`@SqlGroup`]
30+
* xref:testing/annotations/integration-spring/annotation-disabledinaotmode.adoc[`@DisabledInAotMode`]
3031

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[[spring-testing-annotation-disabledinaotmode]]
2+
= `@DisabledInAotMode`
3+
4+
`@DisabledInAotMode` signals that an annotated test class is disabled in Spring AOT
5+
(ahead-of-time) mode, which means that the `ApplicationContext` for the test class will
6+
not be processed for AOT optimizations at build time.
7+
8+
If a test class is annotated with `@DisabledInAotMode`, all other test classes which
9+
specify configuration to load the same `ApplicationContext` must also be annotated with
10+
`@DisabledInAotMode`. Failure to annotate all such test classes will result in an
11+
exception, either at build time or run time.
12+
13+
When used with JUnit Jupiter based tests, `@DisabledInAotMode` also signals that the
14+
annotated test class or test method is disabled when running the test suite in Spring AOT
15+
mode. When applied at the class level, all test methods within that class will be
16+
disabled. In this sense, `@DisabledInAotMode` has semantics similar to those of JUnit
17+
Jupiter's `@DisabledInNativeImage` annotation.
18+
19+
For details on AOT support specific to integration tests, see
20+
xref:testing/testcontext-framework/aot.adoc[Ahead of Time Support for Tests].

framework-docs/modules/ROOT/pages/testing/testcontext-framework/aot.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ following features.
1919
use an AOT-optimized `ApplicationContext` that participates transparently with the
2020
xref:testing/testcontext-framework/ctx-management/caching.adoc[context cache].
2121

22+
All tests are enabled in AOT mode by default. However, you can selectively disable an
23+
entire test class or individual test method in AOT mode by annotating it with
24+
xref:testing/annotations/integration-spring/annotation-disabledinaotmode.adoc[`@DisabledInAotMode`].
25+
When using JUnit Jupiter, you may selectively enable or disable tests in a GraalVM native
26+
image via Jupiter's `@EnabledInNativeImage` and `@DisabledInNativeImage` annotations.
27+
Note that `@DisabledInAotMode` also disables the annotated test class or test method when
28+
running within a GraalVM native image, analogous to JUnit Jupiter's
29+
`@DisabledInNativeImage` annotation.
30+
2231
[TIP]
2332
====
2433
By default, if an error is encountered during build-time AOT processing, an exception

0 commit comments

Comments
 (0)