Reputation: 1291
Hey guys I have a problem. I'm using Spring and I have a class with an injected boolean
protected boolean ignoreVisibleFlag;
I have verified that indeed that property lives in my properties file:
and I have verified that I have this in my Application Context XML:
<context:property-placeholder location="classpath.properties" />
However I still get the following stack trace:
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'boolean'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value
at org.springframework.beans.TypeConverterSupport.doConvert(TypeConverterSupport.java:77)
Any ideas?
Upvotes: 0
Views: 232
Reputation: 1291
M. Deinum's fix worked. I needed to add the to my dispatcher servlet.
Upvotes: 0
Reputation: 8414
From past experience using primitive wasn't able to handle the casting from string (as read) to boolean.
What you need to do is use Object instead of the primitive which will enable the conversion process from String to boolean.
@Value("${mojo.ignoreAlertsVisibleFlag}")
protected Boolean ignoreVisibleFlag;
Upvotes: 1