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 ...
随机推荐
- notify()和 notifyAll()有什么区别?(未完成)
notify()和 notifyAll()有什么区别?(未完成)
- zencart随机获取一张产品图片及价格小程序
<?php //header("content-Type: text/html; charset=utf-8"); //@set_time_limit(1800); //@i ...
- go语言合并两个数组
https://stackoverflow.com/questions/16248241/concatenate-two-slices-in-go Add dots after the second ...
- Java : 对象不再使用时,为什么要赋值为 null ?
今天遇到一个比较有意思的问题,对象不再使用时,为什么要赋值为 null ? 在这里我看到一篇文章说的不错,下面是网址,有兴趣的IT友可以看看. https://mp.weixin.qq.com/s/Z ...
- Spring入门篇——AOP基本概念
1.什么是AOP及实现方式 什么是AOP AOP:Aspect Oriented Programming的缩写,意为:面向切面编程,通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术 主要 ...
- Oracle Index 索引监控
1.冗余索引的弊端 大量冗余和无用的索引导致整个数据库性能低下,耗用了大量的CPU与I/O开销,具体表现如下: a.耗用大量的存储空间(索引段的维护与管理) b.增加了DML完成的时间 c.耗用大量统 ...
- java 内部类简单总结
在java中,一个类可以放在另一个类的内部,称之为内部类,相对而言,包含它的类称之为外部类.不过对于Java虚拟机而言,它是不知道内部类这回事的, 每个内部类最后都会被编译为一个独立的类,生成一个独立 ...
- GAN生成式对抗网络(一)——原理
生成式对抗网络(GAN, Generative Adversarial Networks )是一种深度学习模型 GAN包括两个核心模块. 1.生成器模块 --generator 2.判别器模块--de ...
- Dockerfile创建tomcat和jdk,并发布java项目
1.准备好需要的jdk 和 tomcat kun@ubuntu:~$ cd tomcat-docker/ kun@ubuntu:~/tomcat-docker$ ll total drwxrwxr-x ...
- SpringMVC配置数据验证(JSR-303)
这篇文章已经过时了. 请参考比较合适的前后端交互方式. 1.pom.xml中追加hibernate-validator 2.在dto类的域上追加JSR-303的注解 public class Data ...