Ambiguous handler methods mapped for HTTP path
一、问题:映射重复导致的错误
java代码如下:
@RequestMapping(value = "/info/{remove}/{id}", method = RequestMethod.GET)
public String removeNewsById(@PathVariable("id") long id) {
@RequestMapping(value = "/info/{fav}/{id}", method = RequestMethod.GET)
public String increaseFavoriteById(@PathVariable("id") long id) {
报以下错误:
message Request processing failed; nested exception is java.lang.IllegalStateException:
Ambiguous handler methods mapped for HTTP path 'http://localhost:8080/zc-beauty2/news/info/fav/6':
{public java.lang.String com.zc.beauty.controller.NewsController.removeNewsById(long),
public java.lang.String com.zc.beauty.controller.NewsController.increaseFavoriteById(long)}
我的意图是分别访问 /info/remove/id 和/info/fav/id
上述写法有问题:用{} 包裹起来的变量好像会被模糊化:
/info/{remove}/{id} 和
/info/{fav}/{id}
的映射是重复的
二、解决办法:
写成如下格式:
/info/remove/{id}
对于确定的路径参数不要加{}
问题解决。
以上就介绍了Ambiguous handler methods mapped for HTTP path,包括了方面的内容,希望对JSP教程有兴趣的朋友有所帮助。
转自http://www.codes51.com/article/detail_161369.html
Ambiguous handler methods mapped for HTTP path的更多相关文章
- 异常:java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path '/app/userInfoMaint/getProvince.do'
调试代码时出现异常:java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path '/app/user ...
- 映射重复导致的错误:Ambiguous handler methods mapped for HTTP path
转自:https://cloud.tencent.com/developer/article/1372150 出现了两个名称一样的映射,会报如下错误: 原因: 解决方法: 出现Ambiguous Ma ...
- 常见的java异常——java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path
此异常是由于你的controller中有两个名字与内容相同的方法: 出现此异常时去检查你的controller中是否有重复的名字的方法:
- Ambiguous handler methods mapped for HTTP
前端访问的 controller 地址没有加方法名导致找不到. Servlet.service() for servlet [spring] in context with path [/ssmDem ...
- 使用ControllerAdvice注意事项,Ambiguous @ExceptionHandler method mapped for [class org.springframework.web.bind.MethodArgumentNotValidException]
前言 ControllerAdvice非常好用,可以把系统内部的异常统一处理.用起来也很简单.比如,http://www.cnblogs.com/woshimrf/p/spring-web-400.h ...
- spring websocket报错:No matching message handler methods.
错误信息: [org.springframework.web.socket.messaging.WebSocketAnnotationMethodMessageHandler]-[DEBUG] No ...
- Spring MVC的handlermapping之请求分发如何找到正确的Handler(RequestMappingHandlerMapping)
这个思路同样是通过在AbstractHandlerMethodMapping里面来实现getHandlerInternal()实现自己的方法来处理寻找正确的处理器,不懂得请看上一篇. protecte ...
- handlerMapping的初始化以及查找handler
前提:HttpServletBean初始化了一些servlet配置,接着FrameWorkServlet创建了WebApplicationContext,最后DispatcherServlet初始化一 ...
- Spring MVC 解读——@RequestMapping (2)(转)
转自:http://my.oschina.net/HeliosFly/blog/214438 Spring MVC 解读——@RequestMapping 上一篇文章中我们了解了Spring如何处理@ ...
随机推荐
- vijos P1459 车展(Treap,中位数)
P1459车展 描述 遥控车是在是太漂亮了,韵韵的好朋友都想来参观,所以游乐园决定举办m次车展.车库里共有n辆车,从左到右依次编号为1,2,…,n,每辆车都有一个展台.刚开始每个展台都有一个唯一的 ...
- 2013 ACM区域赛长沙 I LIKE vs CANDLE(ZOJ3734) 很好的一道树形DP
题意:一棵有根树,每个节点都有一个value值和属性(zan或是 CANDLE).你可以通过反转一些点的属性,反转一个点时候,它的整个子树都会被反转属性.有些点反转消耗代价为X,有些为Y.你的目标的是 ...
- 问题记录:spark读取hdfs文件出错
错误信息: scala> val file = sc.textFile("hdfs://kit-b5:9000/input/README.txt") 13/10/29 16: ...
- A题进行时--浙大PAT 1001-1010
pat链接:http://pat.zju.edu.cn 1 #include<stdio.h> 2 int main(){ 3 int a,b; 4 int c; 5 while(scan ...
- Import the Add Email and Post Configuration to the SiteMap managed solution -Dynamices CRM
We have prepared a managed solution named Add Email and Post Configuration to SiteMap that you can i ...
- <转>为什么转置一个512x512的矩阵,会比513x513的矩阵慢很多?
转自evol128 特此表示感谢 http://evol128.is-programmer.com/posts/35453.html 问题的出处:http://stackoverflow.com/q ...
- Golang项目目录结构组织
其实golang的工程管理还是挺简单的,完全使用目录结构还有package名来推导工程结构和构建顺序. 当然,首先要说的是环境变量$GOPATH,项目构建全靠它.这么说吧,想要构建一个项目,就要将这个 ...
- 对css中的浮动属性float刨根解牛
1.浮动的框可以向左或向右移动,直到它的外边缘碰到包含框或另一个浮动框的边框为止. 脱离常规流,由于浮动框不在文档的普通流中,所以文档的普通流中的块框表现得就像浮动框不存在一样. 2.几张图说明浮动常 ...
- SQLite 入门教程(一)基本控制台(终端)命令 (转)
转于: SQLite 入门教程(一)基本控制台(终端)命令 一.基本简介 SQLite 是一个自持的(self-contained).无服务器的.零配置的.事务型的关系型数据库引擎.因为他很小,所 ...
- iOS_icon命名规范 (iPhone_retina屏幕开发)
iOS_icon命名规范 (iPhone_retina屏幕开发) 规则: 位置名称_功能名称_ 详细区分标志名称@2x.png navigationItem_leftBackIcon@2x.png ...