You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/aot-cache.adoc
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,18 @@
4
4
5
5
AOT cache is a https://openjdk.org/jeps/483[JVM feature] that can help reduce the startup time and memory footprint of Java applications.
6
6
7
-
If you're using Java < 24, you should read the sections about CDS.
7
+
If you are not yet using Java 25 or above, you should read the sections about CDS.
8
8
CDS is the predecessor of AOT cache, but works similarly.
9
9
10
-
Spring Boot supports both CDS and AOT cache, and it is recommended that you use AOT cache if it is available in the JVM version you are using (Java 24 or later).
10
+
NOTE: Spring Boot supports both CDS and AOT cache, however, we recommend using the AOT cache whenever possible.
11
+
12
+
11
13
12
14
[[packaging.aot-cache.aot-cache]]
13
15
== AOT Cache
14
16
15
-
NOTE: If you're using Java < 24, AOT cache is not available.
16
-
You have to use CDS instead.
17
+
NOTE: Spring Boot supports the AOT cache for Java 25 and above.
18
+
If you're using an earlier version of Java, you have to use CDS instead.
17
19
18
20
To use the AOT cache feature, you should first perform a training run on your application in extracted form:
19
21
@@ -40,7 +42,7 @@ NOTE: You have to use the cache file with the extracted form of the application,
40
42
[[packaging.aot-cache.cds]]
41
43
== CDS
42
44
43
-
NOTE: If you're using Java 24 or later, please use AOT cache instead of CDS.
45
+
NOTE: If you're using Java 25 or above, please use AOT cache instead of CDS.
44
46
45
47
To use CDS, you should first perform a training run on your application in extracted form:
Copy file name to clipboardExpand all lines: documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/container-images/dockerfiles.adoc
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,27 @@ As the last steps, it creates the AOT cache file by doing a training run and pas
If you are using Java 25 or above, and want to additionally enable the xref:reference:packaging/class-data-sharing.adoc#packaging.class-data-sharing.aot-cache[AOT cache], you can use this `Dockerfile`:
84
+
[source,dockerfile]
85
+
----
86
+
include::reference:partial$dockerfile[]
87
+
88
+
# Execute the AOT cache training run
89
+
RUN java -XX:AOTCacheOutput=app.aot -Dspring.context.exit=onRefresh -jar application.jar
90
+
91
+
# Start the application jar with AOT cache enabled - this is not the uber jar used by the builder
92
+
# This jar only contains application code and references to the extracted jar files
93
+
# This layout is efficient to start up and AOT cache friendly
0 commit comments