some.property=1,2,3,4,5
@Bean
public ConversionService conversionService() {
return new DefaultConversionService();
}
@Value("${some.property}")
final List<Integer> ints;
with this setup I'm getting Caused by: java.lang.NumberFormatException: For input string: "1,2,3,4,5"
Question:
- Why it treats property as
String.class
and ignores explicit class typeList<Integer>
? - Is there a way to convert to correct
List<Integer>
without implementing customConversionService.convert
method?
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.6</version>
</parent>