Cannot map 'XXXController.Create' bean method
【转 :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的更多相关文章
- 【实战问题】【2】Ambiguous mapping found. Cannot map 'xxController.Create' bean method
正文: 启动项目时出现该报错. 原因为:在controller中url映射出现重复,@RequestMapping(value = "user/create"). 解决方案为:全局 ...
- 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 'xxxxController' bean method
1.背景 今天要做一个demo,从github上clone一个springmvc mybatis的工程(https://github.com/komamitsu/Spring-MVC-sample-u ...
- Ambiguous mapping found. Cannot map 'competeController' bean method
报错: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMapp ...
- 简单的map转换成Bean的工具
简单的map转换成Bean的工具 package com.sd.microMsg.util; import java.lang.reflect.Field; import java.lang.refl ...
- java中Map转化为bean
Map 集合类用于存储元素对(称作“键”和“值”),其中每个键映射到一个值,在java编程中会经常用到.但是当我们进行业务逻辑的处理或着操作数据库时,往往应用的是我们自己定义的的Bean或VO来传递和 ...
- there is already 'RtController' bean method 项目报错
今天开发项目时候发现项目报错启动的时候,也没有具体指的是哪一行报错,其实很简单的知道,首先看下报错信息: there is already 'RtController' bean method pub ...
- Spring-test使用JUnit时,测试类autowired报错,create bean error
Spring-test使用JUnit时,测试类里面使用autowired会报错, 报create bean error...... 但是controller里面@autowired可以正常运行的. 在 ...
- 问题排查之'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 ...
随机推荐
- php微信分享demo
php微信分享demo //定义JSSDK类 <?php class JSSDK { private $appId; private $appSecret; private $redis; pu ...
- C++ vector 实例
#include <string> #include <iostream> #include <vector> #include <algorithm> ...
- ArcGis API for JavaScript学习——离线部署API
ArcGis API for JavaScript开发笔记——离线部署API 以3.18版API为例: 在加载图图前引用GIS服务是必须的.有两种方法,一是在线引用,而是离线部署引用. 在线引用: & ...
- Codeforces Round #459 (Div. 2):D. MADMAX(记忆化搜索+博弈论)
D. MADMAX time limit per test1 second memory limit per test256 megabytes Problem Description As we a ...
- ZOJ 3231 Apple Transportation 树DP
一.前言 红书上面推荐的题目,在138页,提到了关键部分的题解,但是实际上他没提到的还有若干不太好实现的地方.尤其是在这道题是大家都拿网络流玩弄的大背景下,这个代码打不出来就相当的揪心了..最后在牛客 ...
- axure rp教程(四)动态面板滑动效果
转载自: http://www.iaxure.com/74.html 实现目标: 1. 点击登录滑出登录面板 2. 点击确定滑出动态面板 最终效果如下: 这种效果可以通过两种方法实现: 首先准备需 ...
- 试水新的Angular4 HTTP API
本文来自网易云社区 作者:梁月康 原文:https://netbasal.com/a-taste-from-the-new-angular-http-client-38fcdc6b359b Angul ...
- 不同storyboard间跳转
小项目中用到storyboard,可以按照模块来新建多个sb. 以下是代码实现跳转实现: UIStoryboard *anSb=[UIStoryboard storyboardWithName:@&q ...
- Careercup - Microsoft面试题 - 5188169901277184
2014-05-12 06:12 题目链接 原题: Write a function to retrieve the number of a occurrences of a substring(ev ...
- windows下使用grunt
grunt官网:http://www.gruntjs.org/ 一.安装grunt 先安装node,在http://www.nodejs.org/可以下载安装包直接安装.在命令行下运行: npm in ...