只是为了使解决方案完整:
将以下依赖项添加到pom.xml
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional></dependency>
并且(这是所有其他答案都缺失的内容)将此执行添加到
kotlin-maven-plugin
<execution> <id>kapt</id> <goals> <goal>kapt</goal> </goals> <configuration> <sourceDirs> <sourceDir>src/main/kotlin</sourceDir> </sourceDirs> <annotationProcessorPaths> <annotationProcessorPath> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <version>1.5.3.RELEASE</version> </annotationProcessorPath> </annotationProcessorPaths> </configuration></execution>
现在是一个示例ConfigurationProperties类:
@ConfigurationProperties(prefix = "logdb")class LogDbProperties { var enabled: Boolean = false}现在运行
mvn compile或
mvn clean compile
和急:你有一个文件名为
spring-configuration-metadata.json在
target/classes/meta-INF。



