There is already 'xxxxx' bean method

来源:互联网 发布:xcode windows能用吗 编辑:程序博客网 时间:2024/06/07 19:58

今天写代码的时候遇到了如下问题

2017-04-26 11:17:02.198  WARN 6411 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'demoController' method public void cn.peakline.controller.DemoController.checkCode(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.String) throws java.io.IOExceptionto {[/demo/checkCode]}: There is already 'demoController' bean methodpublic void cn.peakline.controller.DemoController.getCode(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) mapped.

经过检查,是因为controller里有了多个相同的请求{[/demo/checkCode]},修改或者删除其他方法,确定只有一个请求名称即可

0 0
原创粉丝点击