Suppose you want to inject a list of values in your bean. You can do-
#prop file
mylist=x,y,z
#bean
@Value("${myList}")
String[] myList;But what if you want a List<String> instead of String[]. Sure, you can use the following-
#prop file
mylist=x,y,z
#bean
@Value("#{'${myList}'.split(',')}")
List<String> myList;or event better/cleaner-
#prop file
mylist={'x','y','z'}
#bean
@Value("#{${myList}}")
List<String> myList;But what if you want to add a default value? Here's how-
#prop file
mylist={'x','y','z'}
#bean
@Value("#{${myList:''}}")
List<String> myList;