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),如下图所示:

SpringBoot启动报错: Error creating bean with name ‘“XXXX‘ defined in class path resource_第1张图片
SpringBoot启动报错: Error creating bean with name ‘“XXXX‘ defined in class path resource_第2张图片

你可能感兴趣的:(springboot,spring,boot)