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>

結果就可以了:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM