sebastiandaschner blog

Inject Quarkus list types with @ConfigProperty

#quarkus friday, august 06, 2021

In a previous post, you’ve seen how to map complex configuration structures with Quarkus using @ConfigMapping. If you have a typed collection, e.g. List<String>, you can also inject these values via @ConfigProperty:

public class CoffeeShopConfig {

    @ConfigProperty(name = "complex.list")
    List<String> list;



The list can be populated either by a hierarchical config type such as YAML, or via indexed properties:


You will need to use Quarkus 2.1.0.Final or newer for this example.


Found the post useful? Subscribe to my newsletter for more free content, tips and tricks on IT & Java: