For further reference, please consider the following sections:
The following guides illustrate how to use some features concretely:
- Building a RESTful Web Service
- Serving Web Content with Spring MVC
- Building REST services with Spring
These additional references should also help you:
- Set these before run the application
export SPRING_DATASOURCE_URL=<db_url>
export SPRING_DATASOURCE_USERNAME=<db_username>
export SPRING_DATASOURCE_PASSWORD=<db_password>
- Run the application:
./gradlew bootRun
- Execute on terminal:
curl http://localhost:8080/actuator/health
- Build the project:
./gradlew build
- Run jacoco report:
./gradlew jacocoTestReport
- Run jacoco report:
./gradlew detekt
- Build the project:
./gradlew build
- Run ktlint check:
./gradlew ktlintCheck
- If you find ktlint issues with tabs run:
./gradlew ktlintFormat
- Run the application:
./gradlew bootRun
- Open in any browser:
http://localhost:8080/swagger-ui.html
- Update the project name in the following files:
settings.gradle.kts
build.gradle.kts
(jacoco exclusion configs)SampleApplication
(change to your application name)api-docs-swagger.yaml
(change to your application name)
-
Create a postgres database and grant privileges on it to a database user
-
Set the environment variables
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/<database_name>
export SPRING_DATASOURCE_USERNAME=<database_username>
export SPRING_DATASOURCE_PASSWORD=<database_password>
-
Run the app with
./gradlew bootRun
-
Test it is working on terminal:
curl http://localhost:8080/actuator/health
(should get a 200)