如何在 yaml quarkus 中映射嵌套对象配置
how to mapping nested object configuration in yaml quarkus
如何将 application.yml 映射到配置文件?
这里我有配置 application.yml
games-config:
config:
- variation-number: 6
game-name: Match the shadow
number-of-items: 5
- variation-number: 5
game-name: Drag object to matching Basket
number-of-items: 4
- variation-number: 5
game-name: Re arrange the words
number-of-items: 0
- variation-number: 5
我尝试用这个映射
public class GameConfig {
public Integer variationNumber;
public String gameName;
public Integer numberOfItems;
}
@ConfigProperties(prefix = "games-config")
public class GamesListConfig {
@ConfigProperty(name = "config")
public List<GameConfig> config;
}
但我总是遇到这样的错误:
enter image description here
这需要 Quarkus 版本 1。11.x。以前的版本不支持具有复杂对象类型的列表。
如何将 application.yml 映射到配置文件?
这里我有配置 application.yml
games-config:
config:
- variation-number: 6
game-name: Match the shadow
number-of-items: 5
- variation-number: 5
game-name: Drag object to matching Basket
number-of-items: 4
- variation-number: 5
game-name: Re arrange the words
number-of-items: 0
- variation-number: 5
我尝试用这个映射
public class GameConfig {
public Integer variationNumber;
public String gameName;
public Integer numberOfItems;
}
@ConfigProperties(prefix = "games-config")
public class GamesListConfig {
@ConfigProperty(name = "config")
public List<GameConfig> config;
}
但我总是遇到这样的错误: enter image description here
这需要 Quarkus 版本 1。11.x。以前的版本不支持具有复杂对象类型的列表。