0

I was able to read a single map like this:

@Value("#{${valuesMap}}")
private Map<String, String> valuesMap;

and a yml like this:

    valuesMap: 
          "{path:'/tmp/aaa',
             ext:'csv',
             ttl:60}"

using the solution described here on this post from stackoverflow.

Now I need to read an array/list of maps like this [{path:/a,ext:csv,ttl:50}, {path:/b,ext:txt,ttl:30},...] using something like this:

@Value("#{${valuesMap}}")
private Map<String, String> valuesMap[];

or

@Value("#{${valuesMap}}")
private List<Map<String, String>> valuesMap;

Is this possible? If yes, how can I do it?

Alberto Pires
  • 319
  • 1
  • 5
  • 10

1 Answers1

0

I managed to make it work using:

@Value("#{${valuesMap}}")
private List<Map<String, String>> valuesMap;

and

    valuesMap: 
          "{{path:'/tmp/aaa',
             extension:'csv',
             ttl:60},
            {path:'/tmp/bbb',
             extension:'txt',
             ttl:40}}"

The synatx could be more friendly but it seams to work now.

Alberto Pires
  • 319
  • 1
  • 5
  • 10