Wednesday, 20 April 2016

How to use xyz.xml file instead of applicationcontext.xml ?


ContextLoaderListener is a ServletContextListener that initializes when your webapp starts up.
By default, it looks for Spring’s configuration file at WEB-INF/applicationContext.xml

You can change this default value by specifying a <context-param> element named contextConfigLocation
Provide XML name in the listener context parameter in web.xml

Example
<listener>
  <listener-class> 
      org.springframework.web.context.ContextLoaderListener 
  </listener-class>
  <context-param>       
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/xyz.xml</param-value>   
  </context-param>
</listener>

No comments:

Post a Comment

Note: only a member of this blog may post a comment.