美文网首页
Spring--contextConfigLocation配置

Spring--contextConfigLocation配置

作者: 栗子酥小小 | 来源:发表于2018-07-18 22:50 被阅读0次
     <!-- avalible during applicatio -->
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/config/applicationContext.xml</param-value>
        </context-param>
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
    
    • 如果是 <context-param>标签内的,如果没有提供值,默认会去找/WEB-INF/applicationContext.xml
        <servlet>
            <servlet-name>dispatcher</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <!-- 配置SpringMVC 需要配置的文件
            spring-dao.xml,spring-service.xml,spring-web.xml
            Mybites -> spring -> springMvc  -->
            <!--avalible in servlet init()-->
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>classpath:/spring/spring-*.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>
    
    • 如果是 <init-param>标签内的,如果没有提供值,默认会去找WEB-INF/*-servlet.xml

    相关文章

      网友评论

          本文标题:Spring--contextConfigLocation配置

          本文链接:https://www.haomeiwen.com/subject/hjzapftx.html