Kotlin & Spring Boot @ConfigurationProperties

With new Spring Boot 2.2 you can do like so:

@ConstructorBinding
@ConfigurationProperties(prefix = "swagger")
data class SwaggerProp(
    val title: String, val description: String, val version: String
)

And don’t forget to include this in your dependencies in build.gradle.kts:

dependencies {
  annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)