报错内容为:Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'bookController' method
原因:总体原因是初始化spring容器时,spring容器中没有对应的Bean,报这个错的情况有:
情况1:忘记写@Bean,@Service等注解
情况2:
正确写法
情况3:pom.xml文件里导的依赖版本互不适配,版本最好都选临近的,如: