I am building a plain simple Java-SE only system based on axon and in-memory storage to learn and experiment with some “advanced” features …
Besides the GiftCard example in the getting started docs, I only find spring based examples on the web. I have several questions regarding the configuration of DI without spring:
- my projection implements an eventHandler that fills a hashMap and a queryHandler to answer queries.
I can do:
MyProjection p = new MyProjection();
.registerModule(new EventHandlingConfiguration().registerEventHandler(c -> projection)) .registerQueryHandler(c -> projection)
But what if my projection requires injection of additional components? I only see configurer(c -> new MyProjection(c.getXXX()); but that would register different instances for event- and query handling.
2.) I need the commandGateway in my Saga. I tried but how can I make the SagaManager "inject" the commandGateay in a saga instance? I tried constructor and setter without success ... I do not have @Inject nor @Autowired on the classpath.
Is this missing in the SE axon-core? Or how can this be done? Can you point me to a core-example using sagas and (non-trivial) event handlers?