Ambiguous mapping. Cannot map 'testController' method

今天定义了2个相同value 但不同method的路径 然后华丽丽的报错了

Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'testController' method to {[POST, GET] /test/login11}: There is already 'testController' bean method

然后看提示信息是路径冲突了,提示我已经有get/post方法了,然后我一脸蒙蔽,我明明定义的是一个get 一个post呀

@RequestMapping(value = "login", method = RequestMethod.GET)
public String login(Model model) {
   }

@RequestMapping(value = "login", method = RequestMethod.POST)
public String loginUser(Model model, String userName, String password, HttpSession session, RedirectAttributes redirectAttributes) {}

然后一番排查 发现是自己傻逼了 自己在最上面的定义了method = {RequestMethod.POST, RequestMethod.GET}

@Controller
@Api(description = "专门用于测试的Controller")
@RequestMapping(value = "/test/", method = {RequestMethod.POST, RequestMethod.GET})
public class TestController {

所以 年轻人 还是要细心点的好

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值