Have you considered @Autowired
ing the constructor or a setter and String.split()
ing in the body?
class MyClass {
private List<String> myList;
@Autowired
public MyClass(@Value("${my.list.of.strings}") final String strs) {
myList = Arrays.asList(strs.split(","));
}
//or
@Autowired
public void setMyList(@Value("${my.list.of.strings}") final String strs) {
myList = Arrays.asList(strs.split(","));
}
}
I tend to prefer doing my autowiring in one of these ways to enhance the testability of my code.