Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Injection in CommandHandler does not work with javax.inject.Provider #1068
Our project is a Spring Boot application with hierarchical Spring contexts which depend on each other. As this creates cycles in some few cases, we let Spring inject providers for the dependencies instead of the dependencies directly. For this purpose we use the JSR330 provider interface.
This works fine in Spring beans, but not with Axon command handlers. Let's ignore the hierarchical context and assume we have a bean
The same goes for the following:
But the following won't work:
It results in
I would assume that the injection of a provider would work as well. If needed I can upload a minimal working example for the whole issue (without hierarchical contexts).
As our case is actually an aggregate and the command handler is the constructor we don't have the possibility to provide the dependencies in another way.
Thank you and best regards
the support for injecting Spring beans in
If you know of an easy way to change the