Spring native & AOT instrumentation (POC)
The goal of this project is to try to add ahead-of-time (AOT) instrumentation to a Spring native image.
An alternative approach with programmatic instrumentation is available here.
To test this project
We are going to apply the following transformations:
Spring Boot jar with Spring AOT processing => AOT instrumentation => native image
First, clone this project.
Execute mvn install
.
After, you need a Spring Boot 3 application. You can use this one in this project.
Execute cd spring-boot-app-demo
and then mvn -Pnative native:compile
, that will generate a jar with the Spring ahead-of-time processing applied.
Then, apply ahead-of-time instrumentation. execute this test.
Finally, transform the jar containing the Spring AOT processing and the AOT instrumentation to a native image:
pack build --builder paketobuildpacks/builder:tiny --path target/spring-boot-3-app-instrumented.jar --env BP_NATIVE_IMAGE=true image-native-aot
It will fail with the unlinkat /workspace/META-INF/maven:
permission denied error. To do to make it works: add the drwxr-xr-x
Unix file attribute for JAR directories and -rw-r--r--
for the JAR files.