This is a sample application that demonstrates how to build a Kotlin + Spring Boot applications with a PostgreSQL database. The code is very concise, and the generated application is a 18 MBytes self-contained executable jar with low memory consumption.
A detailed blog post describing this application is available here.
It is used as a playground to demonstrate various features:
- Gradle build.gradle.kts file written in Kotlin instead of Groovy, see gradle-script-kotlin for more details.
- Simple User and Message domain model classes thanks to Kotlin data classes.
- The Application class shows how to configure a Kotlin Spring Boot application.
- Typesafe SQL DSL with Exposed that allows to define your SQL tables and describe your SQL requests with a fluent API without requiring code generation.
demonstrates how to use Spring Framework 4.3 upcoming
@PostMappingannotation shortcuts, as well as Server-Sent Events to push data to the client.
- Kotlin extensions allows to add Geospatial support to Exposed and use it as if this was supported out of the box.
- The REST API is fully tested and documented thanks to the awesome Spring REST docs , see MessageControllerTests and index.adoc.
A Spring Data version based on spring-data-jdbc-repository is also available in this branch. There is no Spring Data JPA version yet but feel free to fork this repo and contribute it with a pull request!
Run the application
- Install a PostgreSQL database with PostGis extension, on Mac you can use Postgresapp.
- Clone this repository.
- Customize database configuration on application.yml.
- Run it within your IDE or with
http://localhost:8080/in your browser.
- Documentation should be available at
http://localhost:8080/docs/index.htmlwhen run from the JAR.