I have been scratching my head all day on this one and after much googling, I have finally resorted to sending my first question to the forum!
I have an aggregate root that looks so something like this
public class ExtractJob extends AbstractAnnotatedAggregateRoot
private static final long serialVersionUID = -5719618724217467458L;
private String id;
public ExtractJob(CreateExtractJobCommand command, IServerConfiguration serverConfiguration, DataSource dataSource)
and I wish to inject some Spring beans (serverConfiguration and dataSource) into @CommandHandler constructor above.
According to what I have read, I should just need to the following in my Spring application context file
<axon:annotation-config event-bus=“axonEventBus” command-bus=“axonCommandBus”/>
but I am still getting:
Constructor threw exception; nested exception is org.axonframework.common.annotation.UnsupportedHandlerException: On method public au.com.calibreFT.extracts.domain.ExtractJob(au.com.calibreFT.extracts.commands.CreateExtractJobCommand,au.com.calibreFT.serverConfig.IServerConfiguration,javax.sql.DataSource), parameter 2 is invalid. It is not of any format supported by a providedParameterValueResolver.
I am using Axon 2.1.2 and was wondering if anybody can provide some guidance in getting this working?
A few extra points which may be helpful:
I can confirm that the two Spring Beans that I am trying to inject are valid as they are being injected into an Event Handler without any issues.
I have tried to debug the Axon source code and its appears that the SpringBeanParameterResolverFactory is not available in the collection of resolvers when the ParameterValueResolver tries to validate the Constructor signature causing the “parameter 2 is invalid. It is not of any format supported by a providedParameterValueResolver” error to be thrown