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

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
PCI Perspectives
PCI Perspectives
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
量子位
博客园_首页
S
SegmentFault 最新的问题
S
Secure Thoughts
F
Full Disclosure
H
Hacker News: Front Page
博客园 - 三生石上(FineUI控件)
U
Unit 42
H
Heimdal Security Blog
N
News and Events Feed by Topic
A
About on SuperTechFans
C
CERT Recently Published Vulnerability Notes
Cyberwarzone
Cyberwarzone
Help Net Security
Help Net Security
The Hacker News
The Hacker News
L
LINUX DO - 最新话题
Application and Cybersecurity Blog
Application and Cybersecurity Blog
罗磊的独立博客
N
News | PayPal Newsroom
Spread Privacy
Spread Privacy
C
Cisco Blogs
C
CXSECURITY Database RSS Feed - CXSecurity.com
云风的 BLOG
云风的 BLOG
A
Arctic Wolf
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Simon Willison's Weblog
Simon Willison's Weblog
B
Blog
人人都是产品经理
人人都是产品经理
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
Hugging Face - Blog
Hugging Face - Blog
I
InfoQ
D
DataBreaches.Net
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
L
LINUX DO - 热门话题
Google Online Security Blog
Google Online Security Blog
V
Visual Studio Blog
V
Vulnerabilities – Threatpost
Know Your Adversary
Know Your Adversary
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
B
Blog RSS Feed

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

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