49

What's the best approach?

1- Create multiple projects:

enter image description here

2- Create a single project:

enter image description here

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
bsferreira
  • 1,189
  • 5
  • 14
  • 27
  • Possible duplicate of [Spring and MVC proper project structure](http://stackoverflow.com/questions/12397940/spring-and-mvc-proper-project-structure) – starcorn Dec 30 '15 at 22:50

2 Answers2

61

I'd suggest you take a look at Spring's Project Sagan. It's the source code for their current website (http://spring.io). While they used a multi-module approach, it wasn't divided as you are suggesting. They really just pulled out some client work and kept the rest in a single module.

This site was written by the Spring team the way they would use their own tools and released as a reference application to answer questions just like this. I encourage you to take a look here: https://github.com/spring-io/sagan.

Michael Minella
  • 20,843
  • 4
  • 55
  • 67
  • 4
    Thanks that's really helpful in many aspects, but not what I was thinking... I don't even see a WEB-INF folder, web.xml, etc... – bsferreira May 09 '14 at 15:08
  • That is by design. There typically is no need for a web.xml anymore. With regards to a WEB-INF directory, the WAR structure is built via the build scripts themselves. – Michael Minella May 09 '14 at 19:22
  • 4
    Your answer lead me to this https://www.youtube.com/watch?v=tEm0USdF-70 which was the structure I followed. Thanks – bsferreira May 11 '14 at 23:25
  • 3
    Another guidance I found from their documentation specified another structure though https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-structuring-your-code.html – starcorn Jan 04 '16 at 13:05
  • @MichaelMinella: can you please tell me where is the routing file resides ? – Praveen_Shukla Feb 29 '16 at 19:19
  • @MichaelMinella How can I import it is eclipse, it seems to have so many components like sagan-client, sagan-indexer etc. What is the use of each of those components? – Govinda Sakhare Jun 10 '16 at 12:17
3

The point is to ask yourself what is the point in separation. If you are planning to run them in different containers on different servers, then it makes sense. If it is a large project, it makes sense to separate.

ACV
  • 9,964
  • 5
  • 76
  • 81