Hi,
I was wondering if anyone has already been able to produce an AxonDBEventStore with AxonFramework CDI.
At the moment I have the following producer:
@Produces
@Singleton
public EventBus eventStore(AxonDBConfiguration axonDBConfiguration, Serializer serializer, @Any Instance upcasters)
{
EventUpcasterChain eventUpcasterChain = new EventUpcasterChain(Streams.stream(upcasters.iterator()).collect(Collectors.toList()));
AxonDBEventStore axonDBEventStore = new AxonDBEventStore(axonDBConfiguration, serializer, eventUpcasterChain);
axonDBEventStore.registerDispatchInterceptor(new AddSourceDispatchInterceptorImpl());
return axonDBEventStore;
}
But changing the return type to AxonDBEventStore gives the following error:
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type EventBus with qualifiers @Default
at injection point [BackedAnnotatedField] @Inject private com.brutex.health.AxonDBTrackingProcessorHealthCheck.eventBus
at com.brutex.health.AxonDBTrackingProcessorHealthCheck.eventBus(AxonDBTrackingProcessorHealthCheck.java:0)
Possible dependencies:
- org.axonframework.cdi.BeanWrapper@174e5016,
- Producer Method [AxonDBEventStore] with qualifiers [@Any @Default] declared as [[BackedAnnotatedMethod] @Produces @Singleton public com.brutex.axon.AxonConfiguration.eventStore(AxonDBConfiguration, Serializer, @Any Instance)]
I don’t understand why it’s perfectly fine to produce an EventBus but producing an AxonDBEventStore leads to ambiguous dependencies. Can anyone shed some light on this?
Regards,
Jens