IDEA开发springboot项目遇到的问题:Cannot resolve MVC View 'XXX'

事情来源:我自己从头写springboot,到了控制类发现接不上静态资源!
找了很久,最后发现,只需要换依赖版本,让spring-boot-starter-thymeleaf和spring-boot-dependencies对应即可!

<properties>
    <spring-boot>2.6.1</spring-boot>
</properties>
<!--springboot使用spring data jpa 为止所添加的依赖-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-dependencies</artifactId>
    <version>${spring-boot}</version>
    <type>pom</type>
    <scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-thymeleaf -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
    <version>${spring-boot}</version>
</dependency>

结果就可以了:

posted @ 2021-12-19 17:00  樱花颂  阅读(1467)  评论(0)    收藏  举报