java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'helloController2' method public ja

向右看齐 2023-08-17 16:24 184阅读 0赞
  1. java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'helloController2' method
  2. public java.lang.String com.shiyaxin.springboot.controller.HelloController2.test()
  3. to {GET /hello/show}: There is already 'helloController' bean method
  4. public java.lang.String com.shiyaxin.springboot.controller.HelloController.test() mapped.
  5. . langIllegalStateException:模糊映射。无法映射“helloController2”方法
  6. 公共. lang。字符串com.shiyaxin.springboot.controller.HelloController2.test ()
  7. to {GET /hello/show}:已经有了'helloController' bean方法
  8. 公共. lang。字符串com.shiyaxin.springboot.controller.HelloController.test()映射。

错误原因是:(模糊映射,spring也识别不了去哪个里)
两个controller的名字都是hello/show
解决办法:
给其中一个controller重名的请求路径换个名字

发表评论

表情:
评论列表 (有 0 条评论,184人围观)

还没有评论,来说两句吧...

相关阅读