栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

带有Spring Boot 2.0 @ConfigurationProperties的Kotlin无法正常工作

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

带有Spring Boot 2.0 @ConfigurationProperties的Kotlin无法正常工作

只是为了使解决方案完整:

将以下依赖项添加到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



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/408555.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号