【发布时间】:2016-01-09 08:53:34
【问题描述】:
我的属性中有以下属性
test.property=context:test:sample
我正在尝试通过与colon(:) 进行拆分并获取第二部分来检索值“test”。
我正在这样做:
@Value("#{'${test.property}'.split(':')[1]}")
private String test;
但是,它似乎以null 出现。我在做什么有问题吗?我在同一个文件中注入了其他属性,它们似乎可以毫无问题地读取。即使我只用@Value("${test.property}") 替换上面的表达式,它似乎也会读取字符串context:test:sample
【问题讨论】:
标签: java spring properties spring-el