笔者最初的一套代码模板

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. python学习之模块(pip),列表生成式,模块操作mysql,excel

    python基础 生成式 列表生成式 格式 [表达式 for 表达式 in 迭代对象 (可加判断)] 原: res1 = [] for i in range(1,5): res1.append(i) ...

  2. JS中constructor,prototype

    First: this this定义: this就是函数赖以执行的对象. 分析这句话: 1. this是对象. 2. this依赖函数执行的上下文环境. 3. this存在函数中. 直接看例子: al ...

  3. 关于EZDML数据库表结构制作设计工具使用踩的坑

    我使用的是一款EZDML的数据库表结构制作设计工具 最开始在数据库创建数据库名为personalmall,基字符集为默认,数据库排序规则也是默认,创建完成之后 去EZDML生成SQL 点击执行sql ...

  4. C#串口图片传输以及对串口缓冲区的简单理解

    第一次接触串口,写点东西加深自己对串口的印象: 通过参考一些网上的实例,我明白了串口怎么简单的进行通信交流,但是我所需要的还是图片等大文件在串口中的传输,串口传输是通过二进制位进行单位传输的,所以传输 ...

  5. [Google Guava] 3-缓存

    原文地址  译文地址    译者:许巧辉  校对:沈义扬 范例 01 LoadingCache<Key, Graph> graphs = CacheBuilder.newBuilder() ...

  6. java-十五周作业

    题目1:编写一个应用程序,输入用户名和密码,访问test数据库中t_login表(字段包括id.username.password),验证登录是否成功. 题目2:在上一题基础上,当登录成功后,将t_u ...

  7. pycharm 头模板

    #!/usr/local/bin/python3 # -*- coding: utf-8 -*- """ @author: Ray @contact: raylively ...

  8. P4568 [JLOI2011]飞行路线 分层图最短路

    思路:裸的分层图最短路 提交:1次 题解: 如思路 代码: #include<cstdio> #include<iostream> #include<cstring> ...

  9. 下拉框 显示name 隐藏code

    暂未做详细整理, 后期有机会完善 jsp 是否有效: <s:select id="queryIsValid" name="configBean.queryIsVal ...

  10. Active Directory 常用属性

    1.获取DirectoryEntry string str = string.Empty; string strPath = @LDAP://testDomain.com.mo; string ad  ...