The experiment I did was keeping all logic of the command handler into external class and injecting as a component to the command handler, and calling from aggregate
Aggregate
public void on ( XYZCommand cmd, XYZCommandHandler handler){
handler.handle(..);
}
XYZCommandHandler
@Component
class XYZCommandHandler {
}
Even after configure the resource using fixture api, as below
@Autowirred
private XYZCommandHandler handler;
@BeforeEach
public void setup(){
fixture = ....
fixture.registerInjectableResource(handler);
}
Getting FixtureExecutionException: No resource of type XYZCommandHandler has been registered.
I have also tried adding, but still same error
fixture.registerParameterResolverFactory(new SpringBeanParameterResolverFactory(applicationContext));