我试图简单地从属性文件中获取值, false像这样的布尔值:
@PropertySource("classpath:/conf/default/server.properties")
........
@Value("${startup.notify.enabled}")
private boolean enabled;
在属性文件中:
startup.notify.enabled=true
为什么会出现此错误?
Caused by: java.lang.IllegalArgumentException: Invalid boolean value [${startup.notify.enabled}]
at org.springframework.beans.propertyeditors.CustomBooleanEditor.setAsText(CustomBooleanEditor.java:123)
at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:464)
at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:437)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:195)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:125)
at org.springframework.beans.TypeConverterSupport.doConvert(TypeConverterSupport.java:61)
这可能是因为占位符吗"${startup.notify.enabled}"?
狐的传说
相关分类