I am using PropertyPlaceholderConfigurer to map String values from properties file and it works ok.
My question is if I can set something the this in my property file: myList=A,B,C
And then map it to a list
@Value("${myList}")
private List<String> myList;
When I try that it puts all the values in one place of the list. Is there any way to tell it to break this to a list by ","?
Using Spring Expression language:
If
myList=A,B,C
in property file this will result inmyList
(in the code) with the valuesA
,B
andC
Take a look at sections 6.5.3 (Inline Lists) and 6.5.4 (Array Construction) on this link to Spring Expression Language Features.
From the link:
I am not sure that this will work exactly like you would like it to with the
@Value
annotation in combination with thePropertyPlaceholderConfigurer
, but it is worth a look.