-
Notifications
You must be signed in to change notification settings - Fork 789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spring: HierarchicalBeanFactory is not supported #1055
Comments
Hi @OLibutzki, thanks for reporting that. It should be fairly trivial to change that, without undesired side-effects. If you're up for the challenge, and are open to creating a PR for this, don't hesitate ;-). Otherwise, we'll pick this up as soon as we've got time for it. |
Hi @abuijze, thanks for your feedback. The outlook that this will be supported is great news for us. Otherwise this might be a blocker in our project. I will try to supply a PR (hopefully next week). In the meantime the sample at my playground turned into a blueprint on how to use Axon with hierarchical spring application contexts. There are two "business modules": module1 and module2. Each of them has a separate jpa token and saga store. The third module is the Axon module which provides the infrastructure stuff like (Event Store (JPA based), Event Bus, Command Bus,... Because of Axon's decent AutoConfiguration facilities the child modules pick up these exposed beans instead of building a separate bean. That's the reason why the other child modules do not use their own event store, command gateway, etc., but us the one provided by the axon module. Things seem to work like a charm. I'm going to migrate my project from our own solution towards Axon now. Maybe there will pop up some new issues... |
Signed-off-by: Oliver Libutzki <oliver.libutzki@bmiag.de>
[#1055] Support for hierarchical application contexts added
Closing this issue as it has been resolved in PR #1071 |
In our application we use Spring Boot's hierarchical application contexts. We have a parent (root) context which maintains all the Axon infrastructure beans (like EventBus, EventStore, CommandGateway, CommandBus,...). Then there are child contexts which use these beans and provide handlers (CommandHandler, EventHandler, QueryHandler).
Unfortunately Axon's Spring integration relies on org.springframework.beans.factory.ListableBeanFactory.getBeansOfType(Class). which does not support hierarchical bean factories. Quote form Javadoc:
There are a couple of other methods which need to be adjusted in order to support hierarchical application context / bean factories...
I created a sample project to illustrate the problem (master): https://github.com/OLibutzki/axon-hierarchical
In the Branch hierarchy-aware I modified org.axonframework.spring.config.SpringAxonAutoConfigurer and org.axonframework.spring.config.CommandHandlerSubscriber. This leads to a working example.
You have to adjust a couple of other classes in order to support hierarchical bean factories, but my code should indicate how to fix this issue.
The text was updated successfully, but these errors were encountered: