<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Spring MVC Integration testing: type mismatch from injection from properties file"]]></title>
		<link>http://forums.hotjoe.com/posts/list/9.page</link>
		<description><![CDATA[Latest messages posted in the topic "Spring MVC Integration testing: type mismatch from injection from properties file"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Spring MVC Integration testing: type mismatch from injection from properties file</title>
				<description><![CDATA[ I hope you can help me with a problem I am having with running a Spring integration test using AbstractTransactionalSpringContextTests to wire my dependencies.  After everything was wired correctly, I started getting some new errors telling me that some of the values injected read from .properties files were having a type mismatch.  When the web application runs. these errors never appear.<br /> <br /> This is the error I was getting:<br /> <br /> [quote]org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource' defined in class path resource [siebel-test-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [int] for property 'cacheSeconds'; nested exception is java.lang.NumberFormatException: For input string: "${dcla.external.properties.cache.second}"<br /> Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [int] for property 'cacheSeconds'; nested exception is java.lang.NumberFormatException: For input string: "${dcla.external.properties.cache.second}"<br /> Caused by: java.lang.NumberFormatException: For input string: "${dcla.external.properties.cache.second}"<br /> 	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)<br /> 	at java.lang.Integer.parseInt(Integer.java:468)<br /> 	at java.lang.Integer.valueOf(Integer.java:547)<br /> 	at java.lang.Integer.decode(Integer.java:908)<br /> 	at org.springframework.util.NumberUtils.parseNumber(NumberUtils.java:146)<br /> 	at org.springframework.beans.propertyeditors.CustomNumberEditor.setAsText(CustomNumberEditor.java:114)<br /> 	at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:343)<br /> 	at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:319)<br /> 	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:192)<br /> 	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)<br /> 	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:380)<br /> [/quote]<br /> <br /> <br /> In a properties file titled 'operations.properties' the value for ${dcla.external.properties.cache.second} is listed as:<br /> <br /> dcla.external.properties.cache.second=120<br /> <br /> <br /> Now, if I hard code the value in the Spring context configuration file, like this<br /> <br /> &lt;property name="cacheSeconds" value="120" /&gt;<br /> <br /> ....it will stop complaining about this value and then complain about another value which Spring says it can not convert from Date to String...<br /> <br /> <br /> When the application runs on it's own, there is no need for a property editor.  Can there be something I can do to get these mismatch errors to stop?  Is there something I am doing wrong?<br /> <br />  <br /> 	]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/687/2584.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/687/2584.page</link>
				<pubDate><![CDATA[Mon, 8 Feb 2010 10:10:05]]> GMT</pubDate>
				<author><![CDATA[ andrew222]]></author>
			</item>
			<item>
				<title>Re:Spring MVC Integration testing: type mismatch from injection from properties file</title>
				<description><![CDATA[ The error is indicating that Spring isn't substituting the ${} string correctly as it is treating it as a string, not a substitution.  Are you confident about the configuration?  It's a little hard to tell base on what you've posted but somewhere Spring doesn't know that it should do the substitution.]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/687/2586.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/687/2586.page</link>
				<pubDate><![CDATA[Mon, 8 Feb 2010 10:19:33]]> GMT</pubDate>
				<author><![CDATA[ stdunbar]]></author>
			</item>
			<item>
				<title>Re:Spring MVC Integration testing: type mismatch from injection from properties file</title>
				<description><![CDATA[ <br /> I was able to solve this by eliminating an extra property placeholder configurers and then setting up one property placeholder for all properties files.]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/687/2589.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/687/2589.page</link>
				<pubDate><![CDATA[Mon, 8 Feb 2010 16:24:57]]> GMT</pubDate>
				<author><![CDATA[ andrew222]]></author>
			</item>
	</channel>
</rss>
