Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Meenachi Suppiah   on Jun 25 In Java Category.

  
Question Answered By: Francis Riley   on Jun 25

This is what I think that works for you presuming that the files  exist.


<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/config/spring/mvc-controllers.xml
/WEB-INF/config/spring/mvc-setting.xml
</param-value>
</context-param>

and this one as well:

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/config/spring/mvc*.xml
</param-value>
</context-param>

Meanwhile spring  normally looks for ${your-servlet}-servlet.xml as the default  applicationContext.xml. That is what your error  was all about. Another option is to put your context  files in classpath and declare them in this way:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:/applicationContext-hibernate.xml
classpath:/applicationContext-services.xml
classpath:/applicationContext-dao.xml
classpath:/applicationContext-core.xml
...
</param-value>
</context-param>

Moreover, There is an import mechanism that spring teams recommends to use to import all your context files (http://www.springframework.org/docs/reference/beans.html#beans-basics , part 3.18). Using the technique, you just declare one xml  file (or use the default and declare nothing in web.xml) and import other context files in such a way :
<beans>

<import resource="services.xml"/>

<import resource="resources/messageSource.xml"/>

<import resource="/resources/themeSource.xml"/>

<bean id="bean1" class="..."/>

<bean id="bean2" class="..."/>
. . .
</beans>

Share: 

 
 
Didn't find what you were looking for? Find more on Spring MVC problem Or get search suggestion and latest updates.


Tagged: