Spring Ahead of Time

Spring AOT processing is part of the process to create a native binary from a Spring (Boot) application. This extension will help in adding a lot of hints which are needed. Please note this extension can only be used with Spring Boot 3, as such it requires at least Java 17.

Besides the extension it might be needed to make more changes to successfully compile and run an application as native image. For example, when a message isn't use in a handler. This is quite common when the application is split, and the application sending certain messages is not the same as the application handling the messages. In those cases these messages need to be added to the ImportRuntimeHints annotation. Otherwise, these messages can't be deserialized, leading to errors at runtime.

If something is not working, or only works with additional hints, and it's Axon Specific, please let us know either at GitHub or Discuss.

Compiling to native

It's important to read through the documentation from Spring itself. There are some known limitations which might require additional changes to the application. In addition, this extension needs to be added by adding the dependency like:


This should be enough to have additional hints with ahead of time compilation to successfully build and run your Axon application.

Performance tips

It can be beneficial to move from JPA implementations to JDBC implementations. This likely decreases both the time it takes to compile the image and the time to start the image.

Last updated