zoukankan      html  css  js  c++  java
  • spring-mvc.xml 和 application-context.xml的区别

    application-context.xml是全局的,应用于多个serverlet,配合listener一起使用,web.xml中配置如下:
    <!-- 配置监听器 -->
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:applicationContext.xml</param-value>
        </context-param>

    spring-mvc.xml 是spring mvc的配置,web.xml中配置如下:
    <!--配置springmvc DispatcherServlet-->
    <servlet>
    <servlet-name>springMVC</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:config/spring-mvc.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
    </servlet>
    application-context.xml这个一般是采用非spring mvc架构,用来加载Application Context。
    如果直接采用SpringMVC,只需要把所有相关配置放到spring-mvc.xml中就好,一般spring mvc项目用不到多个serverlet
  • 相关阅读:
    1004 Counting Leaves
    1003 Emergency (25分)
    1002 A+B for Polynomials (25分)
    1001 A+B Format
    Weekly Contest 139
    491. Increasing Subsequences
    488. Zuma Game
    servlet总结
    firefox插件Firebug的使用教程
    KMP---POJ 3461 Oulipo
  • 原文地址:https://www.cnblogs.com/binlin1987/p/7053016.html
Copyright © 2011-2022 走看看