Mah*_*zad 4 java spring readability properties el
在 Spring 中_使用注释注入时,如何在我的数字属性中包含(下划线)?@Value如果我将其包含_在我的值中,Spring 会抛出TypeMismatchException.
.properties 文件:
min-score=20_000
Run Code Online (Sandbox Code Playgroud)
java类:
@Value("${min-score}")
private int minScore;
Run Code Online (Sandbox Code Playgroud)
在注释中使用 Spring EL@Value来替换_字符:
@Value("#{'${min-score}'.replace('_','')}")
private int minScore;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
877 次 |
| 最近记录: |