Spring @Value之Spring EL解析List

环境:
spring boot 2.0
jdk 1.8

配置文件:

# 自定义属性,可以在Controller中读取
application.hello=Hello Shanhy
application.age=21,22,23

代码:

@Value("#{'${application.age}'.split(',')}")
private List<Integer> age;

你可能感兴趣的:(Spring)