I have the following in my properties file,
increments = 10,20,30
I want to read these properties in my POJO,
@Value("#{'${increments}'.split(',')}")
List<Integer> increments;
List<Integer> getIncrements(){
return increments;
}
And then use this POJO in another class,
List<Integer> increments = pojo.getIncrements();
However, in the last call, I get a conversion error - String to Integer. To overcome this, I am reading the array as a String array, and converting it to Integer array explicitly in the getIncrements() method.
Is there a way to read an array of integers from a properties file into a POJO without explicit type conversion?