Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the recommended project structure for spring boot rest projects?

I'm a beginner with spring boot. I'm involved in the beginning of a project where we would build rest services using spring boot. Could you please advise the recommended directory structure to follow when building a project that will just expose rest services?

like image 728
chip Avatar asked Dec 01 '16 03:12

chip


People also ask

What are the 3 main concepts spring boot provides when it starts your application?

Spring Boot Starter Parent Parent POMs allow you to manage the following things for multiple child projects and modules: Configuration: Java version and other properties. Depedency Management: Version of dependencies. Default plugin configuration.


1 Answers

From the docs:, this is the recommended way

The following listing shows a typical layout:

com      +- example          +- myapplication              +- Application.java              +- customer                  +- Customer.java                  +- CustomerController.java                  +- CustomerService.java                  +- CustomerRepository.java              +- order                  +- order.java                  +- OrderController.java                  +- OrderService.java                  +- OrderRepository. java                   

The Application. java file would declare the main method, along with the basic SpringBootApplication as follows:

package com.example.myapplication;  import org. springframework.boot.springApplication;  import org.springframework.boot.autoconfigure.SprinpootApplication;   @SpringRootApplication public class Application {      public static void main(string[] args)          {              springApplication.run(Application. class, args);          } } 
like image 195
ENDEESA Avatar answered Nov 15 '22 12:11

ENDEESA