Service oriented architecture spring-mvc
java, rest, spring-mvc, web-services
Solution
There is no "best way", it all depends on the circumstances. Does war A rely on a lot of external dependencies or databases? If so, it may be disadvantageous to including it into war B (in effect duplicating the load on all external dependencies) and a web-service approach might be better. If A is a very simple application, maybe the extra complexity of a web-service integration would be overkill. Maybe they should be merged altogether?
In general though, you should ask yourself (or whoever wrote A and B) why they are split into two different application. There is probably a reason for it, and if it's a compelling one you should probably maintain the separation and go for web-service calls.
Problem
I have a spring mvc controller that returns a pojo : ``` @RequestMapping(value = "/person", method = RequestMethod.POST,headers="Accept=application/xml, application/json") public @ResponseBody Person addPerson(@RequestBody Person person) { return personService.add(person); } ``` This controller is located in war file A, on server A. I have another spring app, war file b, that may go on a different server or the same server. Whats the best way to access the addPerson method ? Via an http request or packaging up the class file (and dependicies) as a jar and including in war file b ? Or am I getting the wrong end of the stick and should do something else ?