繁体   English   中英

如何在 yaml quarkus 中映射嵌套的 object 配置

[英]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;
}

但我总是遇到这样的错误:在此处输入图像描述

这需要 Quarkus 版本 1.11.x。 以前的版本不支持具有复杂 object 类型的列表。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM