Spring Boot Best Practices

Version: v1.0.0

                                          
                                           
+---------------------------------------+  ^
|        Global Error Handler           |  |
+---------------------------------------+  |
                                           |
+---------------------------------------+  |
|           Rest Controller             |  |
+---------------------------------------+  |
                                           |
+---------------------------------------+  |
|             Service                   |  |
+---------------------------------------+  |
                                           |
+---------------------------------------+  |
|         JPA Repository                |  |
+---------------------------------------+  |
                                           |
+---------------------------------------+  |
|          Database                     |  |
+---------------------------------------+  +

Setup Project

Import the Project Import the Project to IntelliJ and run Gradle Auto Configuration

Open the Project with InelliJ
Use "gradle" use autoimports => yes

Start the Dev Env Starting the Database and the SonarQube

docker-comopose up

SonarQube

After the docker-compose up you have a local sonarqube instance running at http://localhost:9000

  • Username: admin
  • Password: admin
gradle sonarqube -DsystemProp.sonar.host.url=http://localhost:9000  -DsystemProp.sonar.login={loginToken}

Generic Endpoints

/actuator/health Simple health check method

{ status: "UP" }

/docs Redirect to swagger ui

http://localhost:8080/swagger-ui.html