【转 :http://www.fanfanyu.cn/news/staticpagefile/2351.html】

最近在开发项目的过程中SpringMVC抛了个“Ambiguous mapping found. Cannot map 'clientPoolController' bean method”异常出来,如下(只列出重要的部分,以免篇幅过长):

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'clientPoolController' bean method

......

at java.lang.Thread.run(Thread.java:745)

Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'clientPoolController' bean method

根据上述异常情况,分析得出一下结论:

1. bean重复初始化:使用@controller注解初始化一次,在applicationContext中又定义一次。

注:我通过对项目对应配置文件查找,发现并没有重复初始化的情况。

2. 在不同的Controller中定义的映射重复。

注:项目中clientPoolController与clientController是继承关系,clientPoolController继承clientController。所以重点查找了报错的clientPoolController和clientController发现映射都一致,发现问题所在。

解决方案:

    注释掉clientPoolController中的@Controller标签即可。

   运行测试成功,OK问题解决!

3. 调查发现在同一个controller中url映射出现重复。

Cannot map 'XXXController.Create' bean method的更多相关文章

  1. 【实战问题】【2】Ambiguous mapping found. Cannot map 'xxController.Create' bean method

    正文: 启动项目时出现该报错. 原因为:在controller中url映射出现重复,@RequestMapping(value = "user/create"). 解决方案为:全局 ...

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

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

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

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

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

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

  5. 简单的map转换成Bean的工具

    简单的map转换成Bean的工具 package com.sd.microMsg.util; import java.lang.reflect.Field; import java.lang.refl ...

  6. java中Map转化为bean

    Map 集合类用于存储元素对(称作“键”和“值”),其中每个键映射到一个值,在java编程中会经常用到.但是当我们进行业务逻辑的处理或着操作数据库时,往往应用的是我们自己定义的的Bean或VO来传递和 ...

  7. there is already 'RtController' bean method 项目报错

    今天开发项目时候发现项目报错启动的时候,也没有具体指的是哪一行报错,其实很简单的知道,首先看下报错信息: there is already 'RtController' bean method pub ...

  8. Spring-test使用JUnit时,测试类autowired报错,create bean error

    Spring-test使用JUnit时,测试类里面使用autowired会报错, 报create bean error...... 但是controller里面@autowired可以正常运行的. 在 ...

  9. 问题排查之'org.apache.rocketmq.spring.starter.core.RocketMQTemplate' that could not be found.- Bean method 'rocketMQTemplate' in 'RocketMQAutoConfiguration' not loaded.

    背景 今天将一个SpringBoot项目的配置参数从原有的.yml文件迁移到Apollo后,启动报错“Bean method 'rocketMQTemplate' in 'RocketMQAutoCo ...

随机推荐

  1. 牛客NOIP普及组R1 C括号(dp)

    题意 题目链接 Sol maya普及组的dp都要想很长时间,我真是越来越菜了qwq 设$f[i][j]$表示当前到第$i$个位置,剩下$j$个左括号没被匹配 转移的时候判断一下即可 /* */ #in ...

  2. kubernetes中使用ServiceAccount创建kubectl config 文件

    在kubernetes 为不同的项目创建了不同的SerivceAccount,那么如何通过ServiceAccount创建 kubectl config文件呢?使用下面脚本即可 # your serv ...

  3. 饭卡 HDU - 2546(dp)

    电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额.如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够).所以大家 ...

  4. PowerShell批量配置VM端点

    我们可以通过PowerShell脚本批量添加VM端点.请您参考以下方案. 准备工作 – PowerShell连接China Azure 1. 从官网下载页面,下载并安装Windows Azure Po ...

  5. #2 create and populate a database && realistic and practical applications (PART 2)

    Extends from the last chapter , This chapter takes a look at some real-world problems that can occur ...

  6. Maya

    建立酒杯的方法(CV曲线) surface(曲面)-- creat cv curve tool-- control vertex(调整图形)[再次creat cv建立厚度,只需要建立酒杯的上口]--- ...

  7. 序列化模块--json模块--pickle模块-shelve模块

    什么叫序列化? 序列化是指把内存里的数据类型转变成字符串,以使其能存储到硬盘或通过网络传播到远程,因为硬盘或网络传输时只能接受bytes 例: 把内存数据 转成字符 # data ={# 'roles ...

  8. couchbase map reduce

    map function(){emit(null,2);} reduce function(key, values, rereduce){ var response = {"a": ...

  9. 利用js阻止表单提交

    (1) return false <form name="loginForm" action="login.aspx" method="post ...

  10. Python+Selenium练习篇之18-获取元素上面的文字

    本文介绍如何通过Selenium方法来获取某一个元素的text属性值.在很多自动化测试脚本中,需要多次获取元素的text值,拿过来进行对比和匹配.例如,在一个登陆界面,如果不输入用户名和密码,直接点击 ...