Skip to content

james-freitas/springboot-kotlin-postgres

Repository files navigation

CircleCI

Spring boot Kotlin application

Reference Documentation

For further reference, please consider the following sections:

Guides

The following guides illustrate how to use some features concretely:

Additional Links

These additional references should also help you:

Environment variables

  • Set these before run the application
  export SPRING_DATASOURCE_URL=<db_url>
  export SPRING_DATASOURCE_USERNAME=<db_username>
  export SPRING_DATASOURCE_PASSWORD=<db_password>

Features

Health Check

  1. Run the application: ./gradlew bootRun
  2. Execute on terminal: curl http://localhost:8080/actuator/health

Jacoco

  1. Build the project: ./gradlew build
  2. Run jacoco report: ./gradlew jacocoTestReport

Detekt

  • Run jacoco report: ./gradlew detekt

Ktlint

  1. Build the project: ./gradlew build
  2. Run ktlint check: ./gradlew ktlintCheck
  • If you find ktlint issues with tabs run: ./gradlew ktlintFormat

Swagger

  1. Run the application: ./gradlew bootRun
  2. Open in any browser: http://localhost:8080/swagger-ui.html

How to set up and run the project

  1. 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)
  1. Create a postgres database and grant privileges on it to a database user

  2. 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>
  1. Run the app with ./gradlew bootRun

  2. Test it is working on terminal: curl http://localhost:8080/actuator/health (should get a 200)

About

Springboot 2.3.0 application using Kotlin and Postgres

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published