I’m working on a web application (Spring, Hibernate, Apache Tomcat) with more interfaces (HTML, mobile HTML, XML, REST). So I decided to split application to more web apps to avoid mixing files from the interfaces. I have extracted core classes of the application (business logic, Hibernate DAOs) to external jar and included it to web applications. Everything seemed to be perfect.
But now I have realized there are more instances of the core on the server, more EntityManagerFactories, Spring contexts,…). When I will try to communicate over Spring beans (e.g. add scheduler task in one interface, remove it in another) or use Hibernate second-level cache, it should break down.
What is the best solution?
If you have more webapps, you will have more Spring appcontexts as well. That is a possible workaround that splix suggested, but perhaps it’s too much for your scenario (I would only do that if the application was really big)
I don’t really know what you mean by XML interface. XML-RPC? Webservice?
For the
Have all your logic in a service layer, doesn’t really matter if it’s in an external jar or not if you aren’t going to re-use it in the future, and have one Spring appcontext with many views.