While I was making my app native compatible, I found these are nice to be mentioned in the documentation.

How to enable AOT mode

Running application from IDE with AOT on JVM

The documentation here currently mentions spring.aot.enabled=true for running the application with AOT when using java -jar. However, it would be helpful to add a brief note mentioning that setting this property (e.g., "-Dspring.aot.enabled=true") in the IDE's settings for launching the application can also enable debugging when the app is started from within the IDE.

Additionally, providing an example command for remote debugging with java -jar would be beneficial. For instance:

java -Dspring.aot.enabled=true -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=127.0.0.1:5005 -jar  build/libs/demo-0.0.1-SNAPSHOT.jar

Example to enable AOT in JVM with a gradle task

Provide an example of how to set spring.aot.enabled=true in gradle task.

Here's an example:

bootRun {
    jvmArgs "-Dspring.aot.enabled=true"
    ...
}

How to skip "processAot" task (for gradle)

For debugging AOT-generated code, I included custom logic in the generated code. However, the processAot task always runs and overrides my custom logic. To workaround this, I use gradle bootRun -x processAot to avoid AOT-generated code override. It would be nice to have such a tip described.

How to confirm AOT generated code is in use.

When AOT generated code is in use, the StartupInfoLogger will print Starting AOT-processed ... in the INFO log:

2023-11-05T18:03:33.920-08:00  INFO 91242 --- [           main] c.e.demograalvm.DemoGraalvmApplication   : Starting AOT-processed DemoGraalvmApplication using Java 21 with PID 91242 (/Users/ttsuyukubo/repo/demo-graalvm/build/native/nativeCompile/demo-graalvm started by ttsuyukubo in /Users/ttsuyukubo/repo/demo-graalvm)

Also, programmatically, AotDetector.useGeneratedArtifacts() returns true when AOT is enabled.

It would be nice to mention how users can confirm whether the app is using the AOT generated code.

Comment From: wilkinsona

Thanks for the suggestions.

Additionally, providing an example command for remote debugging with java -jar would be beneficial.

There is nothing Spring Boot-specific about this. We need to draw a line somewhere and we do not think it belongs in Spring Boot's documentation.

Provide an example of how to set spring.aot.enabled=true in gradle task.

We already document that bootRun is a JavaExec task and point out that this means that all of its configuration options are available. We think this is sufficient and is preferable to adding examples for specific properties and configuration settings to the documentation.

For debugging AOT-generated code, I included custom logic in the generated code. However, the processAot task always runs and overrides my custom logic. To workaround this, I use gradle bootRun -x processAot to avoid AOT-generated code override. It would be nice to have such a tip described.

We aren't keen on encouraging people to make changes to the generated code as it should be treated as read-only from a user's perspective. Beyond that, disabling a task with Gradle is not Spring Boot-specific so we don't think it belongs in Boot's documentation. It is already documented in the Gradle docs.

It would be nice to mention how users can confirm whether the app is using the AOT generated code.

We already mention the Starting AOT-processed … message in the docs.

Thanks again for the suggestions but, for the reasons described above, we think it's better to leave things as they are.