This CDI Extension to use AxonFramework 3.x in CDI container environments (Application server or SE).
Minimal tested version is:
Currently the artifact is not (yet) released to Maven Central and you have to build it locally, running from command line:
./mvnw clean install
At some point of time, we will pass this project to AxonIQ and they will release the extension to Maven Central. If you have
created the artifact locally, simply add the following dependency in your Apache Maven pom.xml
:
<dependency>
<groupId>org.axonframework.extension</groupId>
<artifactId>axon-cdi</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
Axon CDI provides easy access to most important AxonFramework building blocks. These can simply be injected in your code:
Similar to Axon Spring, you can define aggregate roots by putting a simple annotation org.axonframework.cdi.stereotype.Aggregate
on your class.
It will be automatically collected by the CDI container and registered (Don't forget the beans.xml
).
Please have a look on examples in example
folder.
The deltaspike
example shows the usage in a Java SE environment (without an application server).
The wildfly
example demonstrates the usage inside of a WildFly application server. To start the server try
cd examples/wildfly
mvn wildfly:run wildfly:deploy
The wildfly-swarm
example demonstrates the usage inside of a WildFly Swarm container. This means packaging the application
together with the required parts of the application server into a single JAR similiar to SpringBoot approach. To start the server try
cd examples/wildfly-swarm
mvn wildfly-swarm:run
If you want to use the JPA based event store inside of a container (e.g. JBoss or Wildfly), you have to configure the following facilities:
https://github.com/holisticon/axon-cdi/issues