【发布时间】:2023-03-15 11:15:01
【问题描述】:
当我启动我的应用程序时出现此错误
java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/SpringDispatcher-servlet.xml]
nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/SpringDispatcher-servlet.xml]
同时,我的 web.xml 或 WEB-INF 文件夹中定义的 mvc-dispatcher-servlet.xml 文件中也没有 SpringDispatcher-servlet.xml 之类的文件。
web.xml 文件
<context-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>SpringDispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SpringDispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
</context-param>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
mvc-dispatcher-servlet.xml 文件
<context:component-scan base-package="aish.vaishno.musicstore.controller" />
<mvc:annotation-driven />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/" />
<property name="suffix" value=".jsp" />
</bean>
请问我怎样才能找到这个文件
/WEB-INF/SpringDispatcher-servlet.xml
请问我哪里错了?
【问题讨论】:
标签: spring spring-mvc servlets configuration-files