Upgrading to 4.7
Unfortunately, but necessarily, Axon Framework 4.7.0 introduces a few breaking changes. If you migrate from 4.6.x (or earlier) versions, you may need to make some adjustments to your code. If you start a greenfield Axon Framework project, there is nothing to worry about. You may safely skip the following information.
The breaking changes are related to the migration from
jakartapackages both in Axon Framework and other frameworks often used together with Axon. Depending on what you were using with 4.6.x version, there are three possible migration paths:
javaxWhile technically possible, the
javaxmigration is not something you should do. If you have already made an effort to switch to the new packages, it makes no sense to go back.
Zero Axon ConfigurationIf you don't have any manual configuration and use the framework's
axon-spring-boot-starter, that the upgrade to 4.7 is seamless.
Adjust packages in
importstatements and FQCNs according to the new locations mentioned below:
If you have customized the
AbstractTokenEntry, rebase your changes on the current
TokenEntry. This is required since the
AbstractTokenEntryhas been deprecated in favor of the
If you have customized the
AbstractSagaEntry, rebase your changes on the current
SagaEntry. This is required since the
AbstractSagaEntryhas been deprecated in favor of the
Remove most mentions of
javaxin your codebase and replace them with respective
jakartaones. Note that not every reference of
javaxis deprecated as part of the Javax-to-Jakarta switch, such as some
javax.cachementions. You can find an exhaustive list of unaffected packages here.
If you are using any other frameworks together with Axon Framework (such as Spring, Hibernate, etc.) make sure to upgrade those to the respective versions supporting
If you migrate to Hibernate 6 and did not customize the sequence generator of the Framework's
association_value_entry, you need to deal with Hibernates adjusted default sequence generator. In this case, your environment uses a so-called
hibernate_sequencethat is used for all your tables. However, Hibernate 6 will construct dedicated sequences per table using a sequence generator.
Although we strongly recommend that you use a dedicated sequence generator per table, the easiest way forward to switch back this new default of Hibernate:
Spring Boot application properties
<!-- omitting other configuration for simplicity... -->
<!-- ensure backward compatibility -->
<property name="hibernate.id.db_structure_naming_strategy" value="legacy"/>
<!-- omitting other properties for simplicity... -->
#omitting other properties for simplicity...
In your dependency configuration (Maven, Gradle, etc.) replace the
jakarta-specific Axon Framework modules with the default ones:
For example, if you want to upgrade to 4.7 and stick with Javax, you can run the following command:
mvn -U org.openrewrite.maven:rewrite-maven-plugin:4.40.0:run \
Can I combine recipes?The mentioned recipes above only allow you to upgrade Axon Framework-specific code. However, you can combine recipes into a single command to, for example, upgrade to Spring Boot 3 and Axon Framework 4.7 in one go:mvn -U org.openrewrite.maven:rewrite-maven-plugin:4.40.0:run \-Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:4.33.0,org.axonframework:axon-migration:LATEST \-DactiveRecipes=org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_0,org.axonframework.migration.UpgradeAxonFramework_4_7_Jakarta