The problem

Kotlin uses the @ConfigurationProperties annotation, and there is no prompt for editing the Application.Yaml file.

The configuration class

@ConfigurationProperties(prefix = "application")
data class AppConfig(
    val storage: AppConfigStorage,

data class AppConfigStorage(
    val namespace: String,

Start the class

class EasyQuestionnaireApplication

fun main(args: Array<String>) {



The test case

internal class AppConfigTest {

    private lateinit var appConfig: AppConfig

    fun test() {

It works fine, but the application.yaml file does not prompt.

Trying to turn on the Settings on IDEA and checking Annotation Processors -> enabling Annotation Processors didn’t work either


After looking at the generated files in the target directory, we found that the spring-configuration-metadata.json file was not generated properly.

The solution

I found the problem on StackOverflow.

The solution was finally found on GitHub.

Add Execution to pom.xml

<plugins> <plugin> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-maven-plugin</artifactId> <executions> <! > < Execution > < ID >kapt</ Goals > <goal>kapt</ Goals > < Configuration > < PathPaths > <annotationProcessorPath> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <! - your own springboot version - > < version > ${springboot. Version} < / version > < / annotationProcessorPath > < / annotationProcessorPaths > </configuration> </execution> <! -> </ resultb1 <dependencies> <dependency> < grouppid > org.jetBrains. kotlin</ grouppid > <artifactId>kotlin-maven-allopen</artifactId> <version>${kotlin.version}</version> </dependency> <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-maven-noarg</artifactId> <version>${kotlin.version}</version>  </dependency> </dependencies> </plugin> </plugins>

Compilation commands are executed each time the spring-configuration-metadata.json file is generated

mvn compile

The results of

After the above steps, the spring-configuration-metadata.json file is successfully generated. The IDEA can also be prompted in the application.yaml file normally.