已解决!!!
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'quanZiController' method
public org.springframework.http.ResponseEntity<java.util.List<com.tanhua.server.vo.VisitorsVo>> com.tanhua.server.controller.QuanZiController.queryVisitorsList()
to {[/movements/visitors],methods=[GET]}: There is already 'quanZiController' bean method
public org.springframework.http.ResponseEntity<java.lang.Object> com.tanhua.server.controller.QuanZiController.queryVisitors() mapped.
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.assertUniqueMethodMapping(AbstractHandlerMethodMapping.java:599) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.register(AbstractHandlerMethodMapping.java:567) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.registerHandlerMethod(AbstractHandlerMethodMapping.java:294) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.lambda$detectHandlerMethods$1(AbstractHandlerMethodMapping.java:279) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[na:na]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.detectHandlerMethods(AbstractHandlerMethodMapping.java:277) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.processCandidateBean(AbstractHandlerMethodMapping.java:249) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:208) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:196) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:164) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 16 common frames omitted
Caused by:java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘quanZiController’ method IllegalStateException:非法状态异常 Ambiguous mapping:模糊影射 Cannot map ‘quanZiController’ method:不能映射quanZiController方法
会不会是少写了什么注解 重新梳理… 该写的注解都写了,没问题
报错信息再往下看
从图中报错信息可知,在com.tanhua.server.controller目录下的QuanZiController类的queryVisitorsList()方法去往get请求路径/movements/visitors:已经存在quanZiController的bean方法
写了两个queryVisitorsList()方法 写了两个get请求路径为/movements/visitors的GetMapping注解
先全局搜索一下queryVisitorsList()这个方法
由图可知此类中只有这一个queryVisitorsList()方法
再搜索一下movements/visitors这个get请求的路径
此时发现此类中居然有两个get请求的路径都是/movements/visitors
点进去查看 发现是最开始写的半成品代码 忘记了,又写了一个这样的方法,所以会同路径,报出这个异常
把这个半成品的代码删除就OK了
运行,启动成功!!!