Statebased Aggregates and SpringBeanParameterResolverFactory

Hello there

I’m switching from event sourced aggregates to aggregates which are stored using JPA (i.e. GenericJpaRepository…).

As long as I used event sourced aggregates methods like the following could be handled by axon (out-of-the-box). Meaning the spring component “PortProvider” has been resolved by the SpringContextParameterResolverFactoryBuilder.

@CommandHandler
public Instance(CreateInstanceCommand cmd, PortProvider portProvider) {

}

Now when switching to JPA the resolution does not work anymore. The reason is, that the SpringBeanParameterResolverFactory is not part of the list in the MultiParameterResolverFactory for such aggregates.

Is there any reason for that? What can I do that in the JPA case the SpringBeanParameterResolverFactory is also part of the resolvers?

Thanks for any help!

Cheers
Marco

P.S: I’m using Spring-Boot 2.1.1

Hi Marco,

Axon should not be biased on this point.
The way Parameter Resolvers are wired in absence of user specific configuration is through the ClasspathParameterResolverFactory.

This implementation does not discriminate between a State-Stored or an Event-Sourced Aggregate.
Thus the behaviour you are noticing is rather odd.

Maybe you have a sample project to share on the matter, showcasing this issue consistently?

By the way, which version of Axon are you on?

Cheers,
Steven