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 ...
随机推荐
- 控制台警告libpng warning: iCCP: known incorrect sRGB profile
用控制台测试数据的时候,出现的这个问题.虽然只是一个警告但是看着就是不太舒服 ,见下图 弄了好长时间,无意间切换个输入法,原先使用的是QQ输入法 切换成微软五笔以后,竟然好了 好了 好了
- mongodb的基本操作之数据创建索引
在数据量较少时,不使用索引,查询是很快的,但是在数据量较大时,查询将会变得非常缓慢,在mongodb中 查看索引 > db.test_collection.getIndexes() [ { &q ...
- 全排列 递归方法(permutation原理
https://blog.csdn.net/axiqia/article/details/50967863 原博客 (一)递归的全排列算法 (A.B.C.D)的全排列为 1.A后面跟(B.C.D)的 ...
- layui模块化使用
layui模块化使用分为两部分: 1.自身模块的设置与使用.2.自定义模块的设置与使用.直接上案例吧 <a>加载入口模块与自定义模块设置: <b>自定义模块名 <c> ...
- 直接插入排序Straight_Insertion_Sort
基本思想:简单排序的一种.如果玩过扑克牌应该都知道顺子,这时有一把顺子但是顺序是乱的,你要去按顺序整理.那第二张牌和第一张牌比较,调整顺序后前两张牌就是有序的,接着第三张牌插入前两张的有序列中,形成三 ...
- vulkan gpu limits in mali
https://community.arm.com/developer/tools-software/graphics/b/blog/posts/memory-limits-with-vulkan-o ...
- Property or method "openPageOffice" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by
Property or method "openPageOffice" is not defined on the instance but referenced during r ...
- Java8-Lock-No.01
import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util ...
- CodeForces 840B - Leha and another game about graph | Codeforces Round #429(Div 1)
思路来自这里,重点大概是想到建树和无解情况,然后就变成树形DP了- - /* CodeForces 840B - Leha and another game about graph [ 增量构造,树上 ...
- PhpStorm 使用 Stylus 回车自动缩进的问题
如图所示,取消勾选即可换行自动缩进,不用再一个个打空格了!