Even after configure the resource using fixture api, FixtureExecutionException: No resource of type has been registered

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));

Are you sure the handler field is correctly injected with a value?

Registering an “injectable resource” is exactly what you need to do to make it useable in a Command Handler.