1

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

1 Answers1

1

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

Roberto Cortez
  • 803
  • 4
  • 8
  • I have similar problem, I am using the latest quarkus and the config values in the list is always null. Even when I create a new instance for GamesListConfig, would it be possible for someone to give me a hint on where I am going wrong. – NightLight Jun 29 '22 at 16:10
  • 1
    Please check this: https://quarkus.io/guides/config-mappings – Roberto Cortez Jun 30 '22 at 11:15