【发布时间】:2018-12-11 11:25:41
【问题描述】:
我需要通过 yaml 属性文件绑定 POJO 列表,但我没有运气让它工作。
我的application.yml 有以下几行:
printer:
printers:
- deviceNo: abc
key: 123
和PrinterProperties 这样:
@Component
@ConfigurationProperties(prefix = "printer")
class PrinterProperties {
var printers: List<Printer> = listOf()
}
但printers 字段未填充application.yml 值。
我将演示推送到github repository 以演示此问题。
【问题讨论】:
-
我将 POJO 从 kotlin 转换为 java,现在可以使用了
-
@Aymen,回复。您建议的编辑:请,Spring Boot 不是 Java EE 的一部分。这是春天的一部分!
标签: spring spring-boot