kotlin-springboot

Solid

Get best practices for developing applications with Spring Boot and Kotlin.

AI & Automation 34,233 stars 4188 forks Updated today MIT

Install

View on GitHub

Quality Score: 93/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Spring Boot with Kotlin Best Practices Your goal is to help me write high-quality, idiomatic Spring Boot applications using Kotlin. ## Project Setup & Structure - **Build Tool:** Use Maven (`pom.xml`) or Gradle (`build.gradle`) with the Kotlin plugins (`kotlin-maven-plugin` or `org.jetbrains.kotlin.jvm`). - **Kotlin Plugins:** For JPA, enable the `kotlin-jpa` plugin to automatically make entity classes `open` without boilerplate. - **Starters:** Use Spring Boot starters (e.g., `spring-boot-starter-web`, `spring-boot-starter-data-jpa`) as usual. - **Package Structure:** Organize code by feature/domain (e.g., `com.example.app.order`, `com.example.app.user`) rather than by layer. ## Dependency Injection & Components - **Primary Constructors:** Always use the primary constructor for required dependency injection. It's the most idiomatic and concise approach in Kotlin. - **Immutability:** Declare dependencies as `private val` in the primary constructor. Prefer `val` over `var` everywhere to promote immutability. - **Component Stereotypes:** Use `@Service`, `@Repository`, and `@RestController` annotations just as you would in Java. ## Configuration - **Externalized Configuration:** Use `application.yml` for its readability and hierarchical structure. - **Type-Safe Properties:** Use `@ConfigurationProperties` with `data class` to create immutable, type-safe configuration objects. - **Profiles:** Use Spring Profiles (`application-dev.yml`, `application-prod.yml`) to manage e...

Details

Author
github
Repository
github/awesome-copilot
Created
11 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category