SpringBoot启动报错: Error creating bean with name ‘“XXXX‘ defined in class path resource

报错信息:

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 'studentController' method 
com.exam.controller.StudentController#queryAll()
to {GET /queryAll}: There is already 'adminController' bean method
com.exam.controller.AdminController#queryAll() mapped.

错误原因:

项目中的Controller(控制层)接口重名了(queryAll),如下图所示:

在这里插入图片描述
在这里插入图片描述


版权声明:本文为qq_45834006原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。