0

Is there a way to have spring framework 4 annotation @Value convert or cast a int[] array to Integer[] array? I know that it is possible to convert an int to Integer. But I am not sure about the array

I am getting the int[] from a configuration file

tcp.port=20001,20002,20003

and using spring's @Value to read those values as a Integer[]

@Value("${tcp.port}")
private Integer[] tcpPorts;

I cannot use int[] because of a generic method in the code. Is there a way to convert/cast int[] to Integer[] with spring? Thank you!

CMPE
  • 1,853
  • 4
  • 21
  • 37

0 Answers0