欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘xxxxController‘ met

程序员文章站 2024-03-14 08:55:40
...

前言

撸了一天的代码,启动时突然报错


错误如下:

Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'xxxxxxController' method 
com.xxx.xxx.controller.xxxxxController#getWeekReportList(MyReportIO)
to { /sleepAid/getWeekReports}: There is already 'xxxxController' bean method
com.xxx.xxx.controller.xxxxController#getWeekReports(MyReportIO) mapped.
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.validateMethodMapping(AbstractHandlerMethodMapping.java:633)
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.register(AbstractHandlerMethodMapping.java:600)
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.registerHandlerMethod(AbstractHandlerMethodMapping.java:318)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.registerHandlerMethod(RequestMappingHandlerMapping.java:350)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.registerHandlerMethod(RequestMappingHandlerMapping.java:67)
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.lambda$detectHandlerMethods$1(AbstractHandlerMethodMapping.java:288)
	at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.detectHandlerMethods(AbstractHandlerMethodMapping.java:286)
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.processCandidateBean(AbstractHandlerMethodMapping.java:258)
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:217)
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:205)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:171)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
	... 16 common frames omitted

原因找到了O(∩_∩)O哈哈~

控制层同一请求映射到两个方法,@RequestMapping(value = “请求方法名”)重复
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘xxxxController‘ met

相关标签: 日常bug