<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Configuring applications with Spring</title>
	<atom:link href="http://blog.carbonfive.com/2008/04/java/configuring-applications-with-spring/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.carbonfive.com/2008/04/java/configuring-applications-with-spring</link>
	<description></description>
	<lastBuildDate>Thu, 11 Mar 2010 14:29:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: sak</title>
		<link>http://blog.carbonfive.com/2008/04/java/configuring-applications-with-spring/comment-page-1#comment-840</link>
		<dc:creator>sak</dc:creator>
		<pubDate>Tue, 02 Jun 2009 15:08:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog/?p=28#comment-840</guid>
		<description>This is a nice overview. The only drawback in all of above examples is that they silently ignore any potential configuration issues. It is often a good idea for the application to complain by throwing an error at start up time in the any of the following cases:

* Properties resource file does not exist
* A required property could not be resolved

I think by always &quot;falling back&quot; to some default setting raises the possibility of mis-configuration. One could be thinking we have a successful deployment on staging when it could be pointing to some other environment like QA ...

Any ideas on how to have strict failure feedback along with above flexibility?</description>
		<content:encoded><![CDATA[<p>This is a nice overview. The only drawback in all of above examples is that they silently ignore any potential configuration issues. It is often a good idea for the application to complain by throwing an error at start up time in the any of the following cases:</p>
<p>* Properties resource file does not exist<br />
* A required property could not be resolved</p>
<p>I think by always &#8220;falling back&#8221; to some default setting raises the possibility of mis-configuration. One could be thinking we have a successful deployment on staging when it could be pointing to some other environment like QA &#8230;</p>
<p>Any ideas on how to have strict failure feedback along with above flexibility?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sega</title>
		<link>http://blog.carbonfive.com/2008/04/java/configuring-applications-with-spring/comment-page-1#comment-256</link>
		<dc:creator>sega</dc:creator>
		<pubDate>Sat, 28 Feb 2009 20:54:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog/?p=28#comment-256</guid>
		<description>Good article, adding it to my bookmarks!</description>
		<content:encoded><![CDATA[<p>Good article, adding it to my bookmarks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lakshman</title>
		<link>http://blog.carbonfive.com/2008/04/java/configuring-applications-with-spring/comment-page-1#comment-214</link>
		<dc:creator>Lakshman</dc:creator>
		<pubDate>Sat, 24 Jan 2009 08:55:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog/?p=28#comment-214</guid>
		<description>Hi,

I have the below bean definition in my application context xml file 

 
        
            ${app.mode}
        
    

&quot;env&quot; is a boolean in Mode class, and here is how I defined the PropertyPlaceholderConfigurer 


        
            file:${conf.dir}/server.properties
        
    

and in my class I am using 

System.setProperty(&quot;JBOSS.conf.dir&quot;, C:/jboss/server/default/conf);
applicationContext = new ClassPathXmlApplicationContext(&quot;applicationContext.xml&quot;);

Now  this {value} is not getting resolved while running the applicaiton. I am getting the below error

org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#039;mode&#039; defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [boolean] for property &#039;env&#039;; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [${app.mode}]]
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1031)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:823)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:318)
	org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:81)
	org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:66)
	org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:57)


Please suggest how to proceed</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I have the below bean definition in my application context xml file </p>
<p>            ${app.mode}</p>
<p>&#8220;env&#8221; is a boolean in Mode class, and here is how I defined the PropertyPlaceholderConfigurer </p>
<p>            file:${conf.dir}/server.properties</p>
<p>and in my class I am using </p>
<p>System.setProperty(&#8220;JBOSS.conf.dir&#8221;, C:/jboss/server/default/conf);<br />
applicationContext = new ClassPathXmlApplicationContext(&#8220;applicationContext.xml&#8221;);</p>
<p>Now  this {value} is not getting resolved while running the applicaiton. I am getting the below error</p>
<p>org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#8216;mode&#8217; defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [boolean] for property &#8216;env&#8217;; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [${app.mode}]]<br />
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1031)<br />
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:823)<br />
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345)<br />
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)<br />
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)<br />
	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275)<br />
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:318)<br />
	org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:81)<br />
	org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:66)<br />
	org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:57)</p>
<p>Please suggest how to proceed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cristian</title>
		<link>http://blog.carbonfive.com/2008/04/java/configuring-applications-with-spring/comment-page-1#comment-205</link>
		<dc:creator>cristian</dc:creator>
		<pubDate>Wed, 31 Dec 2008 14:28:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog/?p=28#comment-205</guid>
		<description>Señores, necesito configurar class=&quot;org.springframework.beans.factory.config.PropertyPlaceholderConfigurer&quot;
para correr mi aplicacion en WAS.


    


necesito saber donde configurar el classpath.</description>
		<content:encoded><![CDATA[<p>Señores, necesito configurar class=&#8221;org.springframework.beans.factory.config.PropertyPlaceholderConfigurer&#8221;<br />
para correr mi aplicacion en WAS.</p>
<p>necesito saber donde configurar el classpath.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajiv</title>
		<link>http://blog.carbonfive.com/2008/04/java/configuring-applications-with-spring/comment-page-1#comment-179</link>
		<dc:creator>Rajiv</dc:creator>
		<pubDate>Wed, 19 Nov 2008 11:15:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog/?p=28#comment-179</guid>
		<description>Thanks christian, that worked :) I just skipped that it takes url :) thanks again for that quick response</description>
		<content:encoded><![CDATA[<p>Thanks christian, that worked <img src='http://blog.carbonfive.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I just skipped that it takes url <img src='http://blog.carbonfive.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  thanks again for that quick response</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: christian</title>
		<link>http://blog.carbonfive.com/2008/04/java/configuring-applications-with-spring/comment-page-1#comment-178</link>
		<dc:creator>christian</dc:creator>
		<pubDate>Wed, 19 Nov 2008 04:14:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog/?p=28#comment-178</guid>
		<description>Rajiv:

Try -Dconfig=file:c://user.properties instead.

Christian</description>
		<content:encoded><![CDATA[<p>Rajiv:</p>
<p>Try -Dconfig=file:c://user.properties instead.</p>
<p>Christian</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rajiv</title>
		<link>http://blog.carbonfive.com/2008/04/java/configuring-applications-with-spring/comment-page-1#comment-177</link>
		<dc:creator>rajiv</dc:creator>
		<pubDate>Tue, 18 Nov 2008 23:04:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog/?p=28#comment-177</guid>
		<description>Hi,
I have specified all the three locations as,

        
            classpath:application.properties
            classpath:local.properties
            ${config}
        
    
and in my tomcat run configuration I have specified a VM argument as -Dconfig=&quot;C:\user.properties&quot;
which looks fine to me but when I run tomcat it complains about file not found \C:\user.properties, Can anyone tell me if am missing anything in here.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I have specified all the three locations as,</p>
<p>            classpath:application.properties<br />
            classpath:local.properties<br />
            ${config}</p>
<p>and in my tomcat run configuration I have specified a VM argument as -Dconfig=&#8221;C:\user.properties&#8221;<br />
which looks fine to me but when I run tomcat it complains about file not found \C:\user.properties, Can anyone tell me if am missing anything in here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: christian</title>
		<link>http://blog.carbonfive.com/2008/04/java/configuring-applications-with-spring/comment-page-1#comment-57</link>
		<dc:creator>christian</dc:creator>
		<pubDate>Wed, 03 Sep 2008 04:46:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog/?p=28#comment-57</guid>
		<description>While JNDI does provide a mechanism for looking up resources, it has its limitations.  For example: if your unit tests have configuration settings that must be overridden, having to bring up a any part of the JEE stack to run your tests is far from ideal.  Also, the multi-level overriding provide by these examples, which come straight from real world projects, isn&#039;t possible with JNDI on its own.

It&#039;s been years since we&#039;ve had a real use for JNDI.  All of our resources are application managed as opposed to configured in a application server.  We avoid depending on the app server whenever possible, as those dependencies make testing difficult or lead to duplicate configuration.  That&#039;s not to say it isn&#039;t a valid solution, it&#039;s just one that doesn&#039;t work for us because of the way we do things.</description>
		<content:encoded><![CDATA[<p>While JNDI does provide a mechanism for looking up resources, it has its limitations.  For example: if your unit tests have configuration settings that must be overridden, having to bring up a any part of the JEE stack to run your tests is far from ideal.  Also, the multi-level overriding provide by these examples, which come straight from real world projects, isn&#8217;t possible with JNDI on its own.</p>
<p>It&#8217;s been years since we&#8217;ve had a real use for JNDI.  All of our resources are application managed as opposed to configured in a application server.  We avoid depending on the app server whenever possible, as those dependencies make testing difficult or lead to duplicate configuration.  That&#8217;s not to say it isn&#8217;t a valid solution, it&#8217;s just one that doesn&#8217;t work for us because of the way we do things.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Willie Wheeler</title>
		<link>http://blog.carbonfive.com/2008/04/java/configuring-applications-with-spring/comment-page-1#comment-56</link>
		<dc:creator>Willie Wheeler</dc:creator>
		<pubDate>Mon, 01 Sep 2008 07:36:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog/?p=28#comment-56</guid>
		<description>Nice post. I like what you say about deploying the same artifact across all environments. Besides externalizing properties, good old-fashioned JNDI is pretty nice in a lot of cases, such as externalizing JDBC DataSources and JavaMail Sessions. Anyway thanks for this post.</description>
		<content:encoded><![CDATA[<p>Nice post. I like what you say about deploying the same artifact across all environments. Besides externalizing properties, good old-fashioned JNDI is pretty nice in a lot of cases, such as externalizing JDBC DataSources and JavaMail Sessions. Anyway thanks for this post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alon Salant</title>
		<link>http://blog.carbonfive.com/2008/04/java/configuring-applications-with-spring/comment-page-1#comment-52</link>
		<dc:creator>Alon Salant</dc:creator>
		<pubDate>Tue, 29 Jul 2008 00:04:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog/?p=28#comment-52</guid>
		<description>Finally, a (relatively) straight forward way to support default config for runtime and test with optional overrides. Nice.
</description>
		<content:encoded><![CDATA[<p>Finally, a (relatively) straight forward way to support default config for runtime and test with optional overrides. Nice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex Cruikshank</title>
		<link>http://blog.carbonfive.com/2008/04/java/configuring-applications-with-spring/comment-page-1#comment-51</link>
		<dc:creator>Alex Cruikshank</dc:creator>
		<pubDate>Wed, 18 Jun 2008 17:25:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog/?p=28#comment-51</guid>
		<description>Thanks for posting this, Christian.  It helped me solve some configuration problems I was having with my company&#039;s CMS solution.  One small drawback of the last example is that it requires the ${config} variable to be set even when the default configuration is sufficient. This is because the ${config} variable will still be unresolved when the second Configurer is instantiated and that Configurer is not set to ignore unresolved properties.  A simple workaround is to add:

&lt;property name=&quot;properties&quot;&gt;
&#160;&#160;&lt;props&gt;&lt;prop key=&quot;config&quot;&gt;&lt;/prop&gt;&lt;/props&gt;
&lt;/property&gt;

to the ServletContextPropertyPlaceholderConfigurer definition.


</description>
		<content:encoded><![CDATA[<p>Thanks for posting this, Christian.  It helped me solve some configuration problems I was having with my company&#8217;s CMS solution.  One small drawback of the last example is that it requires the ${config} variable to be set even when the default configuration is sufficient. This is because the ${config} variable will still be unresolved when the second Configurer is instantiated and that Configurer is not set to ignore unresolved properties.  A simple workaround is to add:</p>
<p>&lt;property name=&#8221;properties&#8221;&gt;<br />
&nbsp;&nbsp;&lt;props&gt;&lt;prop key=&#8221;config&#8221;&gt;&lt;/prop&gt;&lt;/props&gt;<br />
&lt;/property&gt;</p>
<p>to the ServletContextPropertyPlaceholderConfigurer definition.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
