Spring MVC looks for a file named [servlet-name]-servlet.xml in the WEB-INF
来源:互联网 发布:下载压缩包软件 编辑:程序博客网 时间:2024/05/29 00:34
使用如下代码时:
public class MyWebApplicationInitializerimplements WebApplicationInitializer {
@Override public void onStartup(ServletContext container) {
ServletRegistration.Dynamic registration = container.addServlet("example", new DispatcherServlet());
registration.setLoadOnStartup(1);
registration.addMapping("/example/*");
}
}
会发生如下错误
Spring MVC looks for a file named example-servlet.xml in the WEB-INF
实现基于java的零xml配置,需要在DispatcherServlet 里面设置
WebApplicationContext
具体方法如下
AnnotationConfigWebApplicationContext servletAppContext = new AnnotationConfigWebApplicationContext();Class<?>[] configClasses = new Class[]{WebConfig.class};if (!ObjectUtils.isEmpty(configClasses)) { servletAppContext.register(configClasses);}new DispatcherServlet(servletAppContext);
0 0
- Spring MVC looks for a file named [servlet-name]-servlet.xml in the WEB-INF
- spring mvc 启动时报错Could not open ServletContext resource [/WEB-INF/appServlet-servlet.xml]
- webapp的/ WEB - INF /Spring- servlet.xml中配置
- Could not open ServletContext resource [/WEB-INF/spring-servlet.xml]
- spring mvc 默认配置文件 rest-servlet.xml 修改 方法 You have named the DispatcherServlet "rest," so by defau
- servlet解析不出来解决方法(is not a known servlet. Servlets belong in the classpath, often in WEB-INF/classes)
- spring mvc Cannot locate BeanDefinitionParser for element spring-servlet.xml
- spring mvc web.xml dispatcher-servlet.xml配置
- spring-mvc小结<servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframe
- Spring mvc-异常javax.servlet.ServletException: Could not resolve view with name 'xxx' in servlet with
- web.xml中出现<servlet-name>default</servlet-name>是什么意思?
- web.xml中出现<servlet-name>default</servlet-name>是什么意思?
- web.xml中出现<servlet-name>default</servlet-name>是什么意思?
- web.xml中出现<servlet-name>default</servlet-name>是什么意思?
- web.xml中出现<servlet-name>default</servlet-name>是什么意思?
- web.xml中出现<servlet-name>default</servlet-name>是什么意思?
- web.xml中出现<servlet-name>default</servlet-name>是什么意思?
- web.xml中出现<servlet-name>default</servlet-name>是什么意思?
- 自定义Preference时遇到的问题
- 指针和数组
- String类常用方法
- [oracle] 常用函数- 聚合函数
- Oracle常用语句&函数
- Spring MVC looks for a file named [servlet-name]-servlet.xml in the WEB-INF
- Maven使用整理
- 使用Palette提取图片的颜色信息
- 最快的启动页
- JS正则表达式
- 看我如何发现Uber合作方网站XXE 0day漏洞并获得9000美元赏金
- 软件工程的七条基本原理
- 简单工厂模式和策略模式的区别
- 【canvas系列】用canvas实现一个colorpicker(类似PS的颜色选择器)