简体   繁体   中英

how to mapping nested object configuration in yaml quarkus

how can i mapping application.yml to config file?

here i have config in 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

and i try to mapping with this`

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;
}

but i always got error like this: enter image description here

This requires Quarkus version 1.11.x. Lists with complex object types were not supported in previous versions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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