I want to create a web application splitted in extensions structured like this:
- Core
- Backend A - depending on Core (& possibly Backend B)
- Backend B - depending on Core & Backend A
- Frontend A - depending on Backend A & B
- Frontend B - depending on Backend A & B
They should run in a Tomcat. Now my problem is that I still want to provide the ability to inject services from the extensions it depends on. Also, the two frontends should use the same instance of each service defined in the backend extension. It would be a cool feature if the configuration of the Extensions could happen completely annotation-based (WebApplicationInitializer and @Configuration).
What I've tried:
- Creating the Core- and Backend-Extensions as WebApplications does not work, as they then have their own ClassLoaders and Contexts, no injection possible
- Exporting the extensions as libraries to the tomcat and including them into each Frontend-WebApplication does not ensure that the services are the same, also the annotation-based configuration does not work
Whats the best way to solve this?