I have a Spring MVC application with everything currently contained in a single application context on a single JVM. The code is divided up into several layers, and each layer is just pulling the layer it depends on through Maven dependencies. This is an example of my layers:
Spring MVC Layer -> Service Layer -> DAO Layer
The DAO layer has been implemented with JPA through hibernate and contains some synchronized portions.
Right now I am implementing Spring Batch and I want its Service Layer calls to be in the same context/JVM as the calls coming from the Spring MVC layer to take full advantage of the JPA caching and synchonization.
What is the best approach to accomplish this? Do I make the Service Layer into an internal SOAP service? Should the Service layer be split off into a separate WAR?
Any help/advice would be greatly appreciated!
Put your whole Spring batch code into your webapp.
Load your Spring Batch xml file from your MVC application context and your Spring Batch beans will be available in the webapp.
Then you can launch your Spring batches with your webapp : it will execute into the same JVM.