惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
月光博客
月光博客
V
Visual Studio Blog
T
Tailwind CSS Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
Jina AI
Jina AI
J
Java Code Geeks
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
Recorded Future
Recorded Future
C
Check Point Blog
腾讯CDC
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
Hacker News: Ask HN
Hacker News: Ask HN
SecWiki News
SecWiki News
博客园 - Franky
Hacker News - Newest:
Hacker News - Newest: "LLM"
N
News | PayPal Newsroom
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cloudbric
Cloudbric
F
Full Disclosure
The Cloudflare Blog
Y
Y Combinator Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
S
Schneier on Security
Schneier on Security
Schneier on Security
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
AI
AI
N
News and Events Feed by Topic
T
Tor Project blog
P
Palo Alto Networks Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
Google Developers Blog

博客园 - 路人甲乙丙丁张三

wsl安装docker后访问办公网故障 idea springboot多环境指定application.properties VIM 零宽度(断言)匹配用法示例 Oracle Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: HikariDataSource HikariDataSource (HikariPool-1) has been closed. 透镜大灯H4线组的作用,是否需要买线组 vim 查看命令模式关键字总览清单 塘下摩托车驾校流程记录 IDEA 运行 Junit 测试用例报 !!! JUnit version 3.8 or later expected 记一次NoClassDefFoundError解决过程 win10 iis ftp用指定的用户名和密码无法登录 oracle merge into clob 无法从套接字获取更多数据 postman使用全局cookie,模拟浏览器保存cookie 写字板打开txt文件显示乱码问题原因 centos7.6挂载windows共享文件 VMware能上外网却不能和宿主机互相ping通的解决办法 mysql 根据某个字段将多条记录的某个字段拼接成一个字段 jeesite 经常出现java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL解决思路 使用jeesite org.springframework.beans.NotReadablePropertyException: Invalid property 'tfxqCmsAccount.id' of bean class The method getContextPath() is undefined for the type ServletContext
Ambiguous handler methods mapped for HTTP path
路人甲乙丙丁张三 · 2016-07-01 · via 博客园 - 路人甲乙丙丁张三

一、问题:映射重复导致的错误 

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