Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

12-factor compliant Spring MVC Kotlin template. Features automatic request/response validation and interactive API doc

Notifications You must be signed in to change notification settings

cdimascio/kotlin-spring-mvc-template

Open more actions menu

Repository files navigation

kotlin-spring-mvc-template

Spring 5 MVC template with Kotlin and OpenAPI 3.0. (Also Supports Swagger 2.0)

Features automatic request/response validation and interactive API doc

Features:

  • Automatic request and response validation via atlassian OpenApi 3.0
  • Automatic documentation generation via Swagger UI
  • 12 factor compliant configuration via java-dotenv
  • Automatic code formatting and linting via ktlint
  • Fully operational sample REST API
  • API integration tests with Unirest REST client
  • Simple HTTP errors via japi-errors
  • Dockerfile

Setup

  • Clone this repo
  • copy .env.template to src/main/resources/.env

Build

./gradlew build

Format/Lint

./gradlew lintKotlin # see lint errors
./gradlew formatKotlin # attempt to automatically fix lint errors

Run

./gradlew bootRun

Test

./gradlew test

Package / Dist

./gradlew jar

# Run the dist
java -jar ./build/libs/example-service-1.0.0.jar  

Try It

Navigate to http://localhost:8080/api_explorer/index.html

Validate Example

curl -X POST "http://localhost:8080/users" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"me\":\"carmine\"}"

{
  "error": " Object instance has properties which are not allowed by the schema: [\"me\"]",
  "code": 400
}

Interactive Api doc

License

Apache 2.0

About

12-factor compliant Spring MVC Kotlin template. Features automatic request/response validation and interactive API doc

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.