Aggregates and autowiring

Hi, I understand that Axon aggregates are not spring managed, so @Autowired does not work.
A Google search on that topic showed that it is possible to add the desired spring components as parameters to the @CommandHandler annotated method.
But that does not work either, an UnsupportedHandlerException arises.
Is that feature not working with Axon 4 anymore? Or do I misunderstand that trick?

Cheers, Erik

Hi Erik,

the feature definitely still exists in Axon 4. If you let Spring Boot autoconfigure everything, you’ll get the feature automatically.
If you define your own repository, you may need to take special care of configuring the right ParameterResolver in there. If you autowire it from Spring, you will get the right instance automatically.

Hope this helps.