Ambiguous mapping found. Cannot map 'userController' bean method

严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'userController' bean method 
public com.mmall.common.ServerResponse<java.lang.String> com.mmall.controller.portal.UserController.logout(javax.servlet.http.HttpSession)
to {[/user//login.do],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'userController' bean method
public com.mmall.common.ServerResponse<com.mmall.pojo.User> com.mmall.controller.portal.UserController.login(java.lang.String,java.lang.String,javax.servlet.http.HttpSession) mapped.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
    at java.lang.Thread.run(Thread.java:745)
    ...
    ...
Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'userController' bean method 
public com.mmall.common.ServerResponse<java.lang.String> com.mmall.controller.portal.UserController.logout(javax.servlet.http.HttpSession)
to {[/user//login.do],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'userController' bean method
public com.mmall.common.ServerResponse<com.mmall.pojo.User> com.mmall.controller.portal.UserController.login(java.lang.String,java.lang.String,javax.servlet.http.HttpSession) mapped.
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.registerHandlerMethod(AbstractHandlerMethodMapping.java:176)
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.detectHandlerMethods(AbstractHandlerMethodMapping.java:148)
    ... 66 more
  1. 分析情况

    上述情况

Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map ‘userController’ bean method
非法状态异常?发现模棱两可的映射,不能映射userController中的bean方法.
Cannot map ‘userController’ bean method
public ServerResponse UserController.logout(HttpSession)
to {[/user//login.do],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already ‘userController’ bean method
public ServerResponse UserController.login(String,String,HttpSession) mapped.
不能映射userController的bean方法,logout(HttpSession),因为这里已经有了login(String,String,HttpSession)方法,
也就是说这两个方法冲突了,查看源代码发现
@RequestMapping(value=”login.do”,method = RequestMapping.POST)两个方法重复了

  1. 解决问题

    把logout方法的@RequestMapping改成logout.do

  2. 验证问题

    ok

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值