笔者最初的一套代码模板

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的更多相关文章

  1. Ambiguous mapping. Cannot map 'labelInfoController' method

    使用springboot项目中,启动时出现Ambiguous mapping. Cannot map 'labelInfoController' method , 原因是,@RequestMappin ...

  2. Ambiguous mapping. Cannot map 'registerController' method

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappi ...

  3. Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'userController' method

    在使用SpringMVC的时候遇到了这个问题 问题原因:  在指定方法所对应的url地址的时候重复了, 也就是@RequestMapping("url")中, 两个方法使用了同一个 ...

  4. Ambiguous mapping. Cannot map 'xxxController' method

    @GetMapping public JsonResp<List<DtoLandRegion>> getLandRegionList() { List<DtoLandRe ...

  5. java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'waterQuality

    如果一个项目中有两个@RequestMapping("/xxx")完全相同就会报  java.lang.IllegalStateException 改进办法:修改@RequestM ...

  6. Java--- Ambiguous mapping. Cannot map "***Controller" been method解决办法

    打开网页报错: Ambiguous mapping. Cannot map 'handController' method  public com.smallchill.core.toolbox.aj ...

  7. Ambiguous mapping found. Cannot map 'xxxxController' bean method

    1.背景 今天要做一个demo,从github上clone一个springmvc mybatis的工程(https://github.com/komamitsu/Spring-MVC-sample-u ...

  8. SpringMVC“Ambiguous mapping found. Cannot map 'XXXController' bean method”解决方法

    [转 :http://www.fanfanyu.cn/news/staticpagefile/2351.html] 最近在开发项目的过程中SpringMVC抛了个"Ambiguous map ...

  9. Ambiguous mapping found. Cannot map 'competeController' bean method

    报错: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMapp ...

随机推荐

  1. mybatis-oracle 新增序列

    1.参考 https://blog.csdn.net/qq_29001173/article/details/82106853 2.思考: 2.1获取序列下一个值:seq_car.nextval 2. ...

  2. SpringBoot + MySQL + MyBatis 整合 Redis 实现缓存操作

    本地安装 Redis Redis 安装:https://www.cnblogs.com/oukele/p/11373052.html 项目结构:  SpringBootRedis 工程项目结构如下: ...

  3. mybatis+mysql批量插入和批量更新

    一.批量插入 批量插入数据使用的sql语句是: insert into table (字段一,字段二,字段三) values(xx,xx,xx),(oo,oo,oo) mybatis中mapper.x ...

  4. 内存泄露检测之mtrace

    ————————————————版权声明:本文为CSDN博主「知耻而后勇的蜗牛」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明.原文链接:https://blog ...

  5. MyBankgon功能

    .帐户类 User 复制代码 using System; using System.Collections.Generic; using System.Linq; using System.Text; ...

  6. Codevs 2492 上帝造题的七分钟 2(线段树)

    时间限制: 1 s 空间限制: 64000 KB 题目等级 : 大师 Master 题目描述 Description XLk觉得<上帝造题的七分钟>不太过瘾,于是有了第二部. " ...

  7. 【概率论】3-2:连续分布(Continuous Distributions)

    title: [概率论]3-2:连续分布(Continuous Distributions) categories: Mathematic Probability keywords: Continuo ...

  8. 关于要python爬虫你需要的一些网址和信息[待补充]

    phantomjs无头浏览器(基本不用) http://phantomjs.org/download.html 如果报 下面这种错误 [root@hwgz01 ~]# phantomjs phanto ...

  9. 【LeetCode-86】分隔链表

    [题目描述] 给定一个链表和一个特定值 x,对链表进行分隔,使得所有小于 x 的节点都在大于或等于 x 的节点之前. 你应当保留两个分区中每个节点的初始相对位置. 示例: 输入: head = 1-& ...

  10. Mongodb java.util.NoSuchElementException:null 已解决

    public static String find(){ String a=""; try{ MongoCollection<Document> collection ...