java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'helloController2' method public ja
程序员文章站
2022-03-01 13:37:56
...
java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'helloController2' method
public java.lang.String com.shiyaxin.springboot.controller.HelloController2.test()
to {GET /hello/show}: There is already 'helloController' bean method
public java.lang.String com.shiyaxin.springboot.controller.HelloController.test() mapped.
. lang。IllegalStateException:模糊映射。无法映射“helloController2”方法
公共. lang。字符串com.shiyaxin.springboot.controller.HelloController2.test ()
to {GET /hello/show}:已经有了'helloController' bean方法
公共. lang。字符串com.shiyaxin.springboot.controller.HelloController.test()映射。
错误原因是:(模糊映射,spring也识别不了去哪个里)
两个controller的名字都是hello/show
解决办法:
给其中一个controller重名的请求路径换个名字
推荐阅读
-
解决“Ambiguous mapping. Cannot map ‘indexController‘ method”报错,其实很简单,只是不够细心
-
Java Ambiguous mapping. Cannot map ‘xxx‘ method问题解决
-
SpringCloud 整合hystrix使用继承feign调用微服务 IllegalStateException: Ambiguous mapping. Cannot map XXX method
-
BeanCreationException和IllegalStateException: Ambiguous mapping. Cannot map 'brandController' method
-
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'xxx' method
-
Ambiguous mapping. Cannot map 'XXXXXController' method
-
异常java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'xxx' method
-
异常java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'xxx' method
-
2019/03/13 java.lang.IllegalStateException: Ambiguous mapping found. Cannot map '' bean method
-
Ambiguous mapping. Cannot map ‘xxxController‘ method