1.@Value的使用
三种用法
1 // ${key} 从环境变量、配置文件中取值 2 @Value("${person.last-name}") 3 private String lastName; 4 // #{Spel} Spring支持的表达式 5 @Value("#{11*2}") 6 private Integer age; 7 // 字面量 8 @Value("true") 9 private Boolean boss;
1 // ${key} 从环境变量、配置文件中取值 2 @Value("${person.last-name}") 3 private String lastName; 4 // #{Spel} Spring支持的表达式 5 @Value("#{11*2}") 6 private Integer age; 7 // 字面量 8 @Value("true") 9 private Boolean boss;