1.springBoot集成thymeleaf,写了个基本的页面,启动的时候报错
报错信息如下
2020-12-01 12:41:33.923 WARN 23776 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method 'resourceHandlerMapping' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.setUseLastModified(Z)Lorg/springframework/web/servlet/config/annotation/ResourceHandlerRegistration; Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. *************************** |
各种百度以后,发现是pom.xml中引入了不需要的依赖,注解后,重新启动成功;(每个人多引入的包可能不同,检查一下自己是否有引用的多余的,只要不需要的都注释掉)
多次踩坑后终于启动成功