配置文件变量
integer={one:"1", two:"2", three:"3"}
绑定参数时
@Value("#{${integer}}")
private Map<String, String> params;
网上找了好多都是这么写的,但是报错
Expression parsing failed; nested exception is org.springframework.expression.spel.SpelParseException: EL1043E:(pos 4): Unexpected token. Expected 'rcurly(})' but was 'colon(:)'
有大佬知道怎么解决吗?
properties文件配置项用单引号试试:
integer={one:'1', two:'2', three:'3'}
你那配置文件是properties格式还是yaml格式?
请问解决了嘛?我也是这个问题