Axon Framework CDI Support

This Axon Framework module provides support for the CDI programming model. It is a CDI portable extension integrating the Axon Framework and providing some intelligent defaults while still allowing for configuring overrides.

The current minimum supported versions are:

We have so far tested sucessfully against Payara, WildFly, JBoss EAP, TomEE and WebLogic. We will test the module with Thorntail (formerly WildFly Swarm) and WebSphere Liberty/Open Liberty. A contribution testing against WebSphere classic is welcome.


To use the module, simply add the following dependency from Maven Central:


Using Snapshot

To use the snapshot version on the master branch, you will need to build it locally for the time being. Once you have built the artifact locally, simply add the following dependency:


Automatic Configuration

The base Axon Framework is extremely powerful and flexible. What this extension does is to provide a number of sensible defaults for Axon applications while still allowing you reasonable configuration flexibility - including the ability to override defaults. As soon as you include the module in your project, you will be able to inject a number of Axon APIs into your code using CDI. These APIs represent the most important Axon Framework building blocks:


You can provide configuration overrides for the following Axon artifacts by creating CDI producers for them:

For more details on these objects and the Axon Framework, please consult the Axon Framework Reference Guide.


You can define aggregate roots by placing a simple annotation org.axonframework.cdi.stereotype.Aggregate on your class. It will be automatically collected by the CDI container and registered.

Event Handlers and Query Handlers

Event handlers and query handlers must be CDI beans. They will be automatically registered with Axon for you.


Please have a look at the examples in the example folder.

Java EE

The Java EE example demonstrates usage inside any Java EE 7+ compatible application server much as Payara or WildFly. The example is a generic Maven web application you should be able to build on any IDE, generate a Java EE 7 war and deploy to your favorite application server. We have so far tested sucessfully against Payara, WildFly, JBoss EAP, TomEE and WebLogic.

For convenience, we have added Cargo configurations in separate Maven profiles for most supported and tested application servers.

Java SE

The Java SE example demonstrates usage in a non-Java EE, Java SE environment that is CDI enabled (that could include a Servlet-only environment with CDI). Note that while the extension targets CDI 1.1, the example uses the CDI 2 Java SE bootstrap API. It is also easily possible to achieve the same functionality in CDI 1.1 using CDI implementation (such as Weld) specific Java SE bootstrap APIs (in the same vein it is possible to use the CDI 2 Java SE bootstrap API in Servlet containers). The example is a generic Maven Java SE application you should be able to build on any IDE, generate a Java SE executable jar and run from the command line using java -jar.

For convenience, we have added a Maven exec Java plugin in the Maven configuration. You can run the application by simply executing the Maven target: mvn package exec:java

Advanced Usage

Usage of JPA Event Store

If you want to use the JPA based event store inside of a container (e.g. Payara or WildFly), you have to configure the following facilities:

Please see the examples for details.


The module is currently in very early alpha state but is likely fairly feature complete. We are actively maturing it to a first release stage. We welcome early adopters and contributors.

Known Issues

The following are the known issues with the extension. Please also look at our GitHub issue tracker.


The work for Axon to support CDI started in the community. The earliest CDI support for Axon came from the following folks:

A few other folks took this community-driven work a step much further by more closely aligning with newer versions of Axon:

The official Axon support for CDI is based on the collective hard work of these folks in the community. AxonIQ is very grateful to all direct and indirect community contributors to this module.