Spring Boot yaml configuration for a list of strings

I am trying to load an array of strings from application.yml file. This is the config:

ignore:
    filenames:
        - .DS_Store
        - .hg

This is the class:

@Value("${ignore.filenames}")
private List<String> igonoredFileNames = new ArrayList<>();

There are other configurations in the same class that loads just fine. There are no tabs in my YAML file. Still, I get the following exception:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'ignore.filenames' in string value "${ignore.filenames}"

9 Answers
9

Leave a Comment