Spring boot 的 @Value注解读取配置文件中的00开头的字符串:
代码如:
@Value("${spring.boot.bizType}") private String bizType;
配置文件中如:
spring:
boot:
bizType: 0011
在项目启动后:
bizType的值变成了9
原因(我猜的,待确认):
即框架将0011视为八进制的11后转为十进制9。
解决:
修改代码为:
spring:
boot:
bizType: "0011"