springboot整合thymeleaf报错 NoClassDefFoundError: org/thymeleaf/spring5/view/ThymeleafViewResolver

报错的原因是

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-thymeleaf</artifactId>
   <version>1.4.3.RELEASE</version>
</dependency>

的版本与parent(如下)的版本不一样

<parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>2.0.1.RELEASE</version>
   <relativePath/> <!-- lookup parent from repository -->
</parent>

解决方法是去掉spring-boot-starter-thymeleaf的版本号重新reimport就可以了,如下

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>


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