首页 > 编程语言 > 详细

spring-ssm整合报错javax.servlet.ServletException: Servlet.init() for servlet [DispatcherServlet] threw exception

时间:2021-06-10 23:19:16      阅读:40      评论:0      收藏:0      [点我收藏+]

Exception

javax.servlet.ServletException: Servlet.init() for servlet [DispatcherServlet] threw exception

Root Cause

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping‘: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘userController‘ method
public int com.wei.controller.UserController.addUser(com.wei.domain.User)
to {POST /user}: There is already ‘userController‘ bean method
public boolean com.wei.controller.UserController.login(java.lang.String,java.lang.String,javax.servlet.http.HttpSession) mapped.
Root Cause

java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘userController‘ method
public int com.wei.controller.UserController.addUser(com.wei.domain.User)
to {POST /user}: There is already ‘userController‘ bean method
public boolean com.wei.controller.UserController.login(java.lang.String,java.lang.String,javax.servlet.http.HttpSession) mapped.
):注意 主要问题的全部 stack 信息可以在 server logs 里查看

原因是controller层二级PostMapping有两个一样的未命名的重复了

spring-ssm整合报错javax.servlet.ServletException: Servlet.init() for servlet [DispatcherServlet] threw exception

原文:https://www.cnblogs.com/zijing314/p/14872521.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!