thymeleaf,idea 修改頁面每次需要重啟項目設置


環境:idea 2019.2

引入pom依賴:

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


        <!--熱部署-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>

yml配置:

spring:
  mvc:
#   “spring.mvc.static-path-pattern”用於闡述HTTP請求地址,請求非controller地址,如js,css,img等訪問路徑需要加上static
#  而“spring.resources.static-locations”則用於描述靜態資源的存放位置。多個路徑(逗號隔開)中依次查找是否存在
#    static-path-pattern: /static/**
  resources:
    static-locations: classpath:/static/,file:D:\\
  thymeleaf:
    cache: false
    prefix: classpath:/templates/
    suffix: .html
    mode: HTML5
    encoding: UTF-8
#    熱部署
  devtools:
    restart:
#      是否啟用重啟
      enabled: true #      設置重啟的目錄
      additional-paths: src/main/java
      #classpath目錄下的WEB-INF文件夾內容修改不重啟
      spring.devtools.restart.exclude: WEB-INF/**
#      指定程序的配置文件
#  profiles: dev

五、File->settings->Build,Execution,Deployment->Complier:勾選Build project automatically -> apply ->ok

 

 

 

六、shift + alt + ctrl + /

 

 

  

至此當你修改 thymeleaf 模板 HTML 時已經不需要重啟項目了,解決了調試頁面布局以及小的改動就要重啟項目的煩惱!

https://blog.csdn.net/ws_dj_love/article/details/95445590


免責聲明!

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



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