From 644072f7eae72955ae95dc924a69de8cede20f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Thu, 8 Jan 2026 14:48:17 +0100 Subject: [PATCH] Refine the AOT Cache creation section Put Java 25+ snippet first and refine the note. Closes gh-36108 --- .../ROOT/pages/integration/aot-cache.adoc | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/framework-docs/modules/ROOT/pages/integration/aot-cache.adoc b/framework-docs/modules/ROOT/pages/integration/aot-cache.adoc index 0743ef48f8c..57d0aed17c1 100644 --- a/framework-docs/modules/ROOT/pages/integration/aot-cache.adoc +++ b/framework-docs/modules/ROOT/pages/integration/aot-cache.adoc @@ -37,6 +37,14 @@ JVM flag to start and then exit your Spring application once the -- [tabs] ====== + +AOT cache (Java 25+):: ++ +[source,bash,subs="verbatim,quotes"] +---- +java -XX:AOTCacheOutput=app.aot -Dspring.context.exit=onRefresh -jar application.jar ... +---- + AOT cache (Java 24):: + [source,bash,subs="verbatim,quotes"] @@ -46,13 +54,6 @@ java -XX:AOTMode=record -XX:AOTConfiguration=app.aotconf -Dspring.context.exit=o java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconf -XX:AOTCache=app.aot ... ---- -AOT cache (Java 25+):: -+ -[source,bash,subs="verbatim,quotes"] ----- -java -XX:AOTCacheOutput=app.aot -Dspring.context.exit=onRefresh -jar application.jar ... ----- - CDS:: + [source,bash,subs="verbatim,quotes"] @@ -63,9 +64,11 @@ java -XX:ArchiveClassesAtExit=app.jsa -Dspring.context.exit=onRefresh ... ====== -- -NOTE: Note, however, that AOT cache among other things stores the method profiling information. -Therefore, it is generally recommended to create an AOT cache for an application that experienced -a portion of a production-like workflow. This way you can ensure that created AOT cache is more accurate. +NOTE: With Java 25+, AOT cache stores, among other things, the +https://openjdk.org/jeps/515[method profiling information]. Therefore, to benefit of this capability, +it is recommended to create an AOT cache for an application that experienced a portion of a +production-like workflow instead of using the `-Dspring.context.exit=onRefresh` flag which designed to +optimize only the startup of your application. == Using the cache