Spring MVC annotation
来源:互联网 发布:怎么修改淘宝密码 编辑:程序博客网 时间:2024/06/08 08:23
Spring MVC 配置多个基于annotation的Controller时候
多个DispatcherServlet配置转发的的servlet-urlmap时候
DispatcherServlet 1, servletName = a, dispatcherServlet servlet-urlmap /a/*, 那么请求/a/user/get,
对应的Controller 的RequestMapping不需要配置/a/前缀,已经被DispatcherServlet统一转发了
DispatcherServlet 2, servletName = b, dispatcherServlet servlet-urlmap /b/*, 那么请求/b/user/get,
对应的Controller 的RequestMapping不需要配置/a/前缀,已经被DispatcherServlet统一转发了,只配置/user/get即可
使用 AbstractAnnotationConfigDispatcherServletInitializer 进行无web.xml配置时候,一个类就对应于一个DispatcherServlet
多个配置情况下要重写getServletName,RootConfig 和Filter Listener只需要在一个地方配置即可
程序在启动过程中寻找实现了WebInitializer接口的类,并调用onStartup方法去注册各个WebApplication的组件,Controller和url的映射和之前web.xml的一致,对于注解方式的配置还是遵从下面的原则
DispatcherServlet 1, servletName = a, dispatcherServlet servlet-urlmap /a/*, 那么请求/a/user/get,
对应的Controller 的RequestMapping不需要配置/a/前缀,已经被DispatcherServlet统一转发了
DispatcherServlet 2, servletName = b, dispatcherServlet servlet-urlmap /b/*, 那么请求/b/user/get,
对应的Controller 的RequestMapping不需要配置/a/前缀,已经被DispatcherServlet统一转发了,只配置/user/get即可
- spring mvc annotation总结
- [Spring MVC] - Annotation验证
- [Spring MVC] - Annotation验证
- [Spring MVC] - Annotation验证
- Spring MVC annotation (一)
- Spring MVC annotation (二)
- spring mvc annotation
- Spring mvc:annotation-driven
- Spring MVC annotation
- Spring参考手册 mvc:annotation-driven
- Spring MVC 3 -- annotation 配置
- spring mvc annotation 的例子
- Spring MVC MultiActionController annotation example
- Spring MVC MultiActionController annotation example
- spring mvc <mvc:annotation-driver/>详解
- 【Spring MVC】<mvc:annotation-driven/>详解
- Spring MVC 中关于 mvc:annotation-driven
- spring mvc 之mvc:annotation-driven
- 使用启动kafka中producer出现UnrecognizedOptionException错误
- NOIP2016普及组复赛第1题:买铅笔
- C++ 将单链表的每K个结点逆序
- 删除链表中等于给定值Val的所有节点
- 约束布局
- Spring MVC annotation
- Python基本文件操作
- C++的一些基本用法
- [计算机组成原理]--关于磁盘平均存取时间
- JUnit单元测试--IntelliJ IDEA
- 转载:使用 GDB 恢复堆栈信息
- LeetCode 155 Min Stack(实现具有特殊操作的栈)
- 1068. 万绿丛中一点红(20)
- 基于R语言的多元线性回归--我国经济增长的定量研究