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如何处理@ ...
随机推荐
- bzoj 2242 [SDOI2011]计算器(数论知识)
Description 你被要求设计一个计算器完成以下三项任务: 1.给定y,z,p,计算Y^Z Mod P 的值: 2.给定y,z,p,计算满足xy≡ Z ( mod P )的最小非负整数: 3.给 ...
- 问题-Delphi编译到最后Linking时总是出现与ntdll.dll有关的错误还有Fatal Error Out of memory错误
1.跳出错误法 ===================================================在主界面的implementation {$R *.dfm} 下放入以下代码: ...
- Java 随机生成中文姓名,手机号,邮编,住址
package lovo; import java.util.HashMap; import java.util.Map; /** * 随机生成中文姓名,性别,Email,手机号,住址 * @auth ...
- mmsql查看最近操作日志
SELECT TOP 2000 query_stats.query_hash AS "Query Hash", Sum(Query_Stats.total_logical_Read ...
- VM启用ISO共享
在SCVMM中可以启用ISO共享,如下图: 如果不勾选共享镜像复选框,则vmm会把镜像文件通过网络复制到Hyper-v主机下的虚拟机配置文件夹中 配置步骤如下: 1.新建一个共享文件夹(存放ISO), ...
- [Javascript] Object.freeze() vs Object.seal()
let person = { firstName: "Zhentian", lastName: "Wan" }; /*Object.freeze() makes ...
- 安装SQL Server提示“重叠的IO操作正在进行”解决
单位新做了一个虚机.打算部署一套.Net SQL 的系统 系统是Server 2008 R2,机器除了系统,其它软件都没有. 所以须要安装SQL Server啊,.Net环境啊.配置IIS== 恰巧的 ...
- oracle db mos文章 翻译系列
http://blog.csdn.net/msdnchina/article/details/38377125
- careercup-递归和动态规划 9.4
9.4 编写一个方法,返回某集合的所有子集. 类似leetcode:Subsets 解法: 解决这个问题之前,我们先要对时间和空间复杂度有个合理的评估.一个集合会有多少子集?我们可以这么计算,生成了一 ...
- QT线程(二)---线程同步
线程互斥 多线程运行时,通常会访问同一个变量,同一个数据结构,或者同一段代码.因此,需要使用互斥技术来保护上述资源,确保多线程执行的正确性. 注: 我们通常说某个函数是线程安全的,也就是因为该函数 ...