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
While debugging the exception, I noticed that the SpringBeanParameterResolverFactory was not in the collection that was used to resolve parameters. Would anything preclude this resolver being added?
do happen to have more than one implementation of the IServerConfiguration in your application context? If applicationContext.getBean(IServerConfiguration.class) returns more than one instance, the Spring parameter resolver factory ignores it.
Note that it’s normal that the SpringBeanParameterResolverFactory is not in the list of ParamterResolvers. The factory resolves the parmeter value at startup and creates an instance of FixedValueParameterResolver for a specific hander’s parameter.
If you have the Axon source code, you could try to debug the SpringBeanParameterResolverFactory, and put a breakpoint on if line 51. That should show how Axon tries to resolve the parameter of your constructor.