Spring-boot: Improve the package structure documented in the "Structuring your code" section

Created on 27 Jul 2017  路  3Comments  路  Source: spring-projects/spring-boot

https://github.com/spring-projects/spring-boot/blob/master/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc#structuring-your-code

I was wanting to share examples of good package structure based on feature and not by service layer. This was inspired by Mike Gehard's presentation around moving from a monolith to microservices (Step 2 - https://youtu.be/Tx5h3hdvjfw?t=15m33s). I am thinking it would be good to show the same type of structure within the Spring Boot docs to inform developers of that type of structure.

Another reference for this was the java practices page: http://www.javapractices.com/topic/TopicAction.do?Id=205

duplicate documentation

Most helpful comment

Replaced the existing sample with this one.

com
 +- example
     +- myApplication
         +- Application.java
         |
         +- customer
         |   +- Customer.java
         |   +- CustomerController.java
         |   +- CustomerService.java
     |   +- CustomerRepository.java
         |
         +- order
     |   +- Order.java
         |   +- OrderController.java
     |   +- OrderService.java

| +- OrderRepository.java

All 3 comments

Changing the "Here is a typical layout" tree would probably be a nice idea.

Replaced the existing sample with this one.

com
 +- example
     +- myApplication
         +- Application.java
         |
         +- customer
         |   +- Customer.java
         |   +- CustomerController.java
         |   +- CustomerService.java
     |   +- CustomerRepository.java
         |
         +- order
     |   +- Order.java
         |   +- OrderController.java
     |   +- OrderService.java

| +- OrderRepository.java

Duplicate of #9907

Was this page helpful?
0 / 5 - 0 ratings