Ambiguous mapping. Cannot map 'appController' method
笔者最初的一套代码模板
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import java.util.Map; @Controller
@Slf4j
@RequestMapping("app/*")
public class AppController { @RequestMapping("list")
public String list(Model model)
{
return "open/app/list";
} @RequestMapping(name = "list", method = RequestMethod.POST)
public String list(Model model, String keyword)
{
return "open/app/list";
} @RequestMapping("create")
public String create(Model model)
{
return "open/app/editor";
} @RequestMapping(name = "view")
public String view(Model model,Integer id)
{
return "open/app/editor";
} @RequestMapping(name = "save", method = RequestMethod.POST)
@ResponseBody
public Map<String,Object> saveApp()
{
return null;
} @RequestMapping(name = "update" ,method = RequestMethod.POST)
@ResponseBody
public Map<String,Object> update()
{
return null;
}
}
注意标红加粗的地方。
然后又把这个文件复制了一遍重命名,为OrderController,然后就报错了。
最终发现原因是把@RequestMapping里面的参数填写错误,把name改成value
正确代码如下
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import java.util.Map; @Controller
@Slf4j
@RequestMapping("app/*")
public class AppController { @RequestMapping("list")
public String list(Model model)
{
return "open/app/list";
} @RequestMapping(value = "list", method = RequestMethod.POST)
public String list(Model model, String keyword)
{
return "open/app/list";
} @RequestMapping("create")
public String create(Model model)
{
return "open/app/editor";
} @RequestMapping(value = "view")
public String view(Model model,Integer id)
{
return "open/app/editor";
} @RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Map<String,Object> saveApp()
{
return null;
} @RequestMapping(value = "update" ,method = RequestMethod.POST)
@ResponseBody
public Map<String,Object> update()
{
return null;
}
}
Ambiguous mapping. Cannot map 'appController' method的更多相关文章
- Ambiguous mapping. Cannot map 'labelInfoController' method
使用springboot项目中,启动时出现Ambiguous mapping. Cannot map 'labelInfoController' method , 原因是,@RequestMappin ...
- Ambiguous mapping. Cannot map 'registerController' method
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappi ...
- Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'userController' method
在使用SpringMVC的时候遇到了这个问题 问题原因: 在指定方法所对应的url地址的时候重复了, 也就是@RequestMapping("url")中, 两个方法使用了同一个 ...
- Ambiguous mapping. Cannot map 'xxxController' method
@GetMapping public JsonResp<List<DtoLandRegion>> getLandRegionList() { List<DtoLandRe ...
- java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'waterQuality
如果一个项目中有两个@RequestMapping("/xxx")完全相同就会报 java.lang.IllegalStateException 改进办法:修改@RequestM ...
- Java--- Ambiguous mapping. Cannot map "***Controller" been method解决办法
打开网页报错: Ambiguous mapping. Cannot map 'handController' method public com.smallchill.core.toolbox.aj ...
- Ambiguous mapping found. Cannot map 'xxxxController' bean method
1.背景 今天要做一个demo,从github上clone一个springmvc mybatis的工程(https://github.com/komamitsu/Spring-MVC-sample-u ...
- SpringMVC“Ambiguous mapping found. Cannot map 'XXXController' bean method”解决方法
[转 :http://www.fanfanyu.cn/news/staticpagefile/2351.html] 最近在开发项目的过程中SpringMVC抛了个"Ambiguous map ...
- Ambiguous mapping found. Cannot map 'competeController' bean method
报错: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMapp ...
随机推荐
- jade过滤器
以上语法基本讲完了jade的语法,然后在jade里面并不仅仅局限于使用jade语法,同样可以使用其他的插件语言,这种机制在jade里面称为filter,在jade里面加入过滤器用冒号 markdown ...
- Ubuntu系统---C++之Eclipse IDE 编译器安装
Ubuntu系统---C++之Eclipse IDE 编译器安装 Eclipse是一个基于Java的.开放源码的.可扩展的应用开发平台,它为编程人员提供了一流的Java集成开发环境(Integrate ...
- Annoying Present
http://codeforces.com/group/1EzrFFyOc0/contest/1009/problem/C 题意:原本有一个n个0的数组a[],你对它进行m次操作,每次操作让a[j]+ ...
- gorm 更新数据时,0值会被忽略
原文: https://www.tizi365.com/archives/22.html ------------------------------------------------------- ...
- Java锁--共享锁和ReentrantReadWriteLock
转载请注明出处:http://www.cnblogs.com/skywang12345/p/3505809.html ReadWriteLock 和 ReentrantReadWriteLock介绍 ...
- Activation HDU - 4089 (概率DP)
kuangbin的博客 强 #include <bits/stdc++.h> using namespace std; const int MAXN = 2005; const doubl ...
- Educational Codeforces Round 40 (Rated for Div. 2) 954G G. Castle Defense
题 OvO http://codeforces.com/contest/954/problem/G 解 二分答案, 对于每个二分的答案值 ANS,判断这个答案是否可行. 记 s 数组为题目中描述的 a ...
- P4149 [IOI2011]Race 点分治
思路: 点分治 提交:5次 题解: 刚开始用排序+双指针写的,但是调了一晚上,总是有两个点过不了,第二天发现原因是排序时的\(cmp\)函数写错了:如果对于路径长度相同的,我们从小往大按边数排序,当双 ...
- MySQL sql join 算发
在MySQL中,可以使用批量密钥访问(BKA)连接算法,该算法使用对连接表的索引访问和连接缓冲区. BKA算法支持:内连接,外连接和半连接操作,包括嵌套外连接. BKA的优点:更加高效的表扫描提高了连 ...
- 018_查看有多少远程的 IP 在连接本机(不管是通过 ssh 还是 web 还是 ftp 都统计)
#!/bin/bash#使用 netstat -atn 可以查看本机所有连接的状态,-a 查看所有,-t 仅显示 tcp 连接的信息,-n 数字格式显示# Local Address(第四列是本机的 ...