Sahru Ardiansyah
Sahru Ardiansyah

Reputation: 23

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

Upvotes: 2

Views: 1178

Answers (1)

Roberto Cortez
Roberto Cortez

Reputation: 1163

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

Upvotes: 1

Related Questions