<?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: Spring application context loading tricks</title>
	<atom:link href="http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/</link>
	<description>A weblog about software engineering, Architecture, Technology an other things we like.</description>
	<lastBuildDate>Sat, 28 Jan 2012 20:11:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Ben</title>
		<link>http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/comment-page-1/#comment-31334</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Mon, 23 Jan 2012 20:20:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/#comment-31334</guid>
		<description>It&#039;s a little difficult to see exactly what&#039;s going on here, since your XML tags didn&#039;t make it into the posted comment. But the way it looks to me right now, only the dispatcher-servlet-config.xml will be loaded since it is passed to the dispatcher servlet as a servlet init param (and all the beans will be loaded into the namespace of the servlet).

The web-application-config.xml will NOT be loaded, since you have not defined a ContextLoaderListener. If you DO include such a listener, then both context files will be loaded. The beans from web-application-config.xml will be available to the dispatcher-servlet and any other servlet you load; the beans from the dispatcher-servlet-config.xml will only be available to the dispatcher-servlet.</description>
		<content:encoded><![CDATA[<p>It&#8217;s a little difficult to see exactly what&#8217;s going on here, since your XML tags didn&#8217;t make it into the posted comment. But the way it looks to me right now, only the dispatcher-servlet-config.xml will be loaded since it is passed to the dispatcher servlet as a servlet init param (and all the beans will be loaded into the namespace of the servlet).</p>
<p>The web-application-config.xml will NOT be loaded, since you have not defined a ContextLoaderListener. If you DO include such a listener, then both context files will be loaded. The beans from web-application-config.xml will be available to the dispatcher-servlet and any other servlet you load; the beans from the dispatcher-servlet-config.xml will only be available to the dispatcher-servlet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Coder</title>
		<link>http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/comment-page-1/#comment-31333</link>
		<dc:creator>Coder</dc:creator>
		<pubDate>Mon, 23 Jan 2012 06:38:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/#comment-31333</guid>
		<description>In my web.xml we have mentioned contextConfigLocation twice like below in this order. Could you pls tell which one will be picked up as contextConfigLocation file


    contextConfigLocation
    /WEB-INF/config/web-application-config.xml
  


    dispatcher-servlet
    org.springframework.web.servlet.DispatcherServlet
    
      contextConfigLocation
      /WEB-INF/config/dispatcher-servlet-config.xml
    
    1
  </description>
		<content:encoded><![CDATA[<p>In my web.xml we have mentioned contextConfigLocation twice like below in this order. Could you pls tell which one will be picked up as contextConfigLocation file</p>
<p>    contextConfigLocation<br />
    /WEB-INF/config/web-application-config.xml</p>
<p>    dispatcher-servlet<br />
    org.springframework.web.servlet.DispatcherServlet</p>
<p>      contextConfigLocation<br />
      /WEB-INF/config/dispatcher-servlet-config.xml</p>
<p>    1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/comment-page-1/#comment-31315</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Mon, 05 Dec 2011 18:31:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/#comment-31315</guid>
		<description>Hi BenBourne,

Sounds to me like that &quot;spring&quot; directory is not on your classpath.</description>
		<content:encoded><![CDATA[<p>Hi BenBourne,</p>
<p>Sounds to me like that &#8220;spring&#8221; directory is not on your classpath.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BenBourne</title>
		<link>http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/comment-page-1/#comment-31314</link>
		<dc:creator>BenBourne</dc:creator>
		<pubDate>Sat, 03 Dec 2011 19:02:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/#comment-31314</guid>
		<description>Hi Ben,
I have a issue with loading spring-aplication-context.xml.
it is clealry mentioned in web.xml also as:
classpath:spring/spring-aplication-context.xml
where spring is a folder inside which spring-aplication-context.xml resides.
The application is not getting loaded and says filenotfound for spring-aplication-context.xml.
The project is a maven project.
What can be the possible error?</description>
		<content:encoded><![CDATA[<p>Hi Ben,<br />
I have a issue with loading spring-aplication-context.xml.<br />
it is clealry mentioned in web.xml also as:<br />
classpath:spring/spring-aplication-context.xml<br />
where spring is a folder inside which spring-aplication-context.xml resides.<br />
The application is not getting loaded and says filenotfound for spring-aplication-context.xml.<br />
The project is a maven project.<br />
What can be the possible error?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/comment-page-1/#comment-31293</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Fri, 23 Sep 2011 09:46:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/#comment-31293</guid>
		<description>Err, no, it doesn&#039;t. The classpath: prefix refers to the application&#039;s classpath and means that resources will be retrieved from locations on that classpath (although at a given point in time that might indeed include the current working directory). An absolute location &lt;strong&gt;without&lt;/strong&gt; a classpath: prefix is an absolute location and a relative location is relative to the working directory of the application.</description>
		<content:encoded><![CDATA[<p>Err, no, it doesn&#8217;t. The classpath: prefix refers to the application&#8217;s classpath and means that resources will be retrieved from locations on that classpath (although at a given point in time that might indeed include the current working directory). An absolute location <strong>without</strong> a classpath: prefix is an absolute location and a relative location is relative to the working directory of the application.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Praveenkumar Jagnala</title>
		<link>http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/comment-page-1/#comment-31291</link>
		<dc:creator>Praveenkumar Jagnala</dc:creator>
		<pubDate>Tue, 20 Sep 2011 10:40:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/#comment-31291</guid>
		<description>classpath refers to current directory in spring framework.</description>
		<content:encoded><![CDATA[<p>classpath refers to current directory in spring framework.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Praeenkumar jangala</title>
		<link>http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/comment-page-1/#comment-31290</link>
		<dc:creator>Praeenkumar jangala</dc:creator>
		<pubDate>Tue, 20 Sep 2011 10:38:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/#comment-31290</guid>
		<description>ApplicationContext  ctx =new ClassPathXmlApplicationContext(&quot;../applicationContext.xml&quot;);
        BeanFactory beanFactory=ctx; 
It works fine in my spring project

the above code is in /WEB-INF/jsp/index.jsp
but my applicationContext.xml is in /WEB-INF folder</description>
		<content:encoded><![CDATA[<p>ApplicationContext  ctx =new ClassPathXmlApplicationContext(&#8220;../applicationContext.xml&#8221;);<br />
        BeanFactory beanFactory=ctx;<br />
It works fine in my spring project</p>
<p>the above code is in /WEB-INF/jsp/index.jsp<br />
but my applicationContext.xml is in /WEB-INF folder</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sai</title>
		<link>http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/comment-page-1/#comment-31214</link>
		<dc:creator>Sai</dc:creator>
		<pubDate>Wed, 27 Apr 2011 19:38:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/#comment-31214</guid>
		<description>Nice read! Thanks for taking the time out to compose this.</description>
		<content:encoded><![CDATA[<p>Nice read! Thanks for taking the time out to compose this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jettro</title>
		<link>http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/comment-page-1/#comment-31165</link>
		<dc:creator>jettro</dc:creator>
		<pubDate>Mon, 14 Feb 2011 10:05:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/#comment-31165</guid>
		<description>Hmm, I see I mist the whole thread of comments. Did not notice it was a response to another comment. My bad :-)</description>
		<content:encoded><![CDATA[<p>Hmm, I see I mist the whole thread of comments. Did not notice it was a response to another comment. My bad <img src='http://www.gridshore.nl/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/comment-page-1/#comment-31158</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Mon, 31 Jan 2011 21:04:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.gridshore.nl/2008/05/13/spring-application-context-loading-tricks/#comment-31158</guid>
		<description>Hey Jettro,

It is a &quot;mistake&quot; in the sense that, in and of itself, /WEB-INF is not on the classpath. So if you put your context files there and then try to load them by doing something like &quot;classpath:*context.xml&quot; rather than &quot;classpath:/WEB-INF/*context.xml&quot;, then it won&#039;t work. And this is an easy mistake to make, since the DispatcherServlet implicitly initiates the processing of a /WEB-INF/-servlet.xml file, sort of suggesting that /WEB-INF is where you should put the context files.

Also, one might consider it a &quot;mistake&quot; against the style that SpringSource introduced with Spring Roo of always placing context files in the META-INF/spring directory (which, to be honest, is where you *should* put context files that are in a JAR).

Finally, it is definitely a mistake if you put the files in a /webapps/WEB-INF directory when your maven project does not have a &quot;war&quot; packaging. But, uhhhh...... ;-)</description>
		<content:encoded><![CDATA[<p>Hey Jettro,</p>
<p>It is a &#8220;mistake&#8221; in the sense that, in and of itself, /WEB-INF is not on the classpath. So if you put your context files there and then try to load them by doing something like &#8220;classpath:*context.xml&#8221; rather than &#8220;classpath:/WEB-INF/*context.xml&#8221;, then it won&#8217;t work. And this is an easy mistake to make, since the DispatcherServlet implicitly initiates the processing of a /WEB-INF/-servlet.xml file, sort of suggesting that /WEB-INF is where you should put the context files.</p>
<p>Also, one might consider it a &#8220;mistake&#8221; against the style that SpringSource introduced with Spring Roo of always placing context files in the META-INF/spring directory (which, to be honest, is where you *should* put context files that are in a JAR).</p>
<p>Finally, it is definitely a mistake if you put the files in a /webapps/WEB-INF directory when your maven project does not have a &#8220;war&#8221; packaging. But, uhhhh&#8230;&#8230; <img src='http://www.gridshore.nl/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

