Create a spring boot application with multiple child contexts -
i'm trying create application using spring boot hierarchical application context. current main method looks like:
public static void main(string[] args) { new springapplicationbuilder(testapplication.class) .child(auditserviceconfiguration.class).web(true) .child(taskserviceconfiguration.class).web(true) .run(args); } and 2 children configurations annotated with:
@enableautoconfiguration @configuration the idea have parent context containing common beans , each child context run own mvc while being isolated siblings.
unfortunately when run above, last child context initialised , started.
any pointers in right direction appreciated.
regards,
alessandro
the child(...) method creates , returns springapplicationbuilder, when call second child(...) method, not instantiating brother child, making child on first child, makes parent become grandpa.
jokes aside, have @ sibling(...) method allows create context same parent.
you can check out source see going on.
Comments
Post a Comment