Configuration of Axon 4.2 without Spring Boot

Hi, I’m new to Axon framework.
In my evaluation I’m using Axon Server.
With Spring Boot all is easy and fine. But I’m aiming at tying Spring Boot micro services together with a non Spring Boot application, so the AxonServerAutoConfiguration does not work.

What do I have to do to configure Axon 4.2 within an application that is not based on Spring Boot?

Hi Erik,

Actually, you should configure all the facilities you need: CommandBus, EventBus, (EventStore), Serializer and so on…

It depends on your use case. For example an application with event-sourced aggregates could (but not must) use:

  • CommandBus (simple)

  • EventBus (simple)

  • EventStore (use existing implementation and configure it, choose between Axon, JPA, JDBC, In-memory)

  • Single Aggregates (register individual classes, no ComponentScan)

  • EventHandler (register individual classes, no ComponentScan)

  • Serializer

  • TxManager (if you have one)

  • Saga

Luckily, there is a facility called Configurer responsible for all this. Try DefaultConfigurer.defaultConfiguration() which gives you a starting point and call individual methods for configuration.
Please refer to the documentation and have a look on code snippets (you can choose between SpringBoot and non SpringBoot tabs).

Kinds regards,

Simon

Hi Simon,
Thanks for your fast reply.
Is there no way to make use of the AxonServerAutoConfiguration? It seems to configure all these facilities requires some deeper knowledge. Does it have to be so complicated?
Best regards
Erik

Hi Erik,

actually, the Configuration API (start with DefaultConfigurer) helps tou set up all you need. It will also automatically configure AxonServer if the client is on the classpath. It defaults to looking for AxonServer on localhost, so you probably want to provide your own AxonServerConfiguration.

Hope this helps.
Cheers,

Allard