springboot由于controller重复方法出现以下错误

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2020-01-28 11:25:13.592 ERROR[main]org.springframework.boot.SpringApplication.reportFailure:845 -Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘requestMappingHandlerMapping’ defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘contractHumanController’ method
public com.xtj.utils.Result<java.lang.Object> com.xtj.controller.ContractHumanController.update(com.xtj.pojo.ContractHuman)
to {[/contracthuman/update],methods=[POST]}: There is already ‘contractHumanController’ bean method

从提示信息中可以看出是controller层中的错误,但是翻译错误后又看不出是什么错误,就是说某个bean不能被注入啥了,仔细的检查了一下controller层后发现错误原因
在这里插入图片描述
在复制的过程中不小心写了2个相同的名字的controller方法,但是由于修改了传入参数,它还不报错,难受啊,只要将requestMapping中的值和方法名更换了,重启之后正常运行。

猜你喜欢

转载自blog.csdn.net/qq_42584411/article/details/104098341