Enterprise Java

Inject Quarkus list types with @ConfigProperty

Inject Quarkus list types with @ConfigProperty

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.

Published on Java Code Geeks with permission by Sebastian Daschner, partner at our JCG program. See the original article here: Inject Quarkus list types with @ConfigProperty

Opinions expressed by Java Code Geeks contributors are their own.

Sebastian Daschner

Sebastian Daschner is a self-employed Java consultant and trainer. He is the author of the book 'Architecting Modern Java EE Applications'. Sebastian is a Java Champion, Oracle Developer Champion and JavaOne Rockstar.
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Back to top button