Monday, April 30, 2012

Dividing an application with Spring and Mybatis into multiple modules

I'd like to divide my project into multiple maven modules. But I'm not sure of what structure would be preferable. The main goal is to take out the service logic in a separate module.



Right now I have four packages in my project: controller, domain, persistence, service. Say, this can be divided into two main parts: database related stuff (domain and persistence packages) and the service part (service and, oh, maybe a controller). Is this a good structure? Do service and controller packages seem to be a good separated service? I'm pretty sure it's better to put service and controller parts in a single module due to the fact they are autowired now (and also logically wired). Should each child module be a web application of a full value (obviously with a lack of packages and files)?



And I'm not sure about the placement of the web pages. Should they all be in a Spring parent module? That would make sense. But different pages could also be in different web-app modules (I guess), and that also makes sense.



I understand that this question doesn't seem to be a concrete one. It's because I don't have a formed understanding of a preferable (and also of a working) structure. An advice would be appreciated, thanks in advance.





No comments:

Post a Comment