What is use of contextconfiglocation in web.xml of Spring-based web-app?

1.4k Views Asked by At

In Spring, what is purpose of ContextConfigLocation and also InternalResourceViewResolver? I did't get the purpose of these classes.

1

There are 1 best solutions below

0
liviraj On BEST ANSWER

contexConficLocation is using in web.xml file. This purpose is override the acctual or default XML file in user wish. It is comeing under the <contex-param> tag, for example

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>WEB-INF/spring-config.xml,WEB-INF/spring-servlet.xml</param-value>
</context-param>

InternalResourceViewResolver using inside servlet.xml file it is comeing under the viewResolver bean.

Example

<beans>
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="WEB-INF/view/"></property>
        <property name="suffix" value=".jsp"></property>
    </bean>
</beans>