zoukankan      html  css  js  c++  java
  • Maven Could not open ServletContext resource [/WEB-INF/applicationContext.xml]

    因此:maven中,配置文件的读取应有下列红字两部分,缺一不可。

    不是maven项目时,可以都不写。。。。。。。。

     <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/classes/dispatcher-servlet.xml</param-value>
        </context-param>
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        <servlet> <!--spring中唯一的servlet 转发到control层-->
            <servlet-name>dispatcher</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <!--springmvc默认配置的名字:-->
            <!--<servlet-name> springMVC<servlet-name> +  -servlet-->
            <!--设置配置文件-->
            <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/classes/dispatcher-servlet.xml</param-value>
            <!--或<param-value>/WEB-INF/XXX.xml</param-value>-->
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>
    

      

  • 相关阅读:
    【NOI2015】荷马史诗
    Codeforces Round #415 (Div. 2)
    Codeforces Round #408 (Div. 2)
    bzoj3230
    poj1743
    poj1226
    bzoj1295
    bzoj1294
    bzoj1296
    bzoj1239
  • 原文地址:https://www.cnblogs.com/Demonfeatuing/p/9523170.html
Copyright © 2011-2022 走看看