2017-10-21 269 views
1

我發現許多關於禁用模板緩存與Thymeleaf的發展,但我不能讓它的工作。我的堆棧:百里香緩存與春季啓動

  • 春季啓動1.5.7
  • 彈簧引導devtools
  • Thymeleaf
  • 的IntelliJ IDEA終極2017.2

我不需要自動重建:我已將IntelliJ中的「rebuild」命令映射到⌘-S,這對於熱插拔Java類非常有用。但是,如果我重新啓動服務器,css和html模板仍然只顯示更改。

我application.properties:

spring.thymeleaf.prefix=/WEB-INF/templates/ 
spring.thymeleaf.cache=false 

我已經試過:
•移動Templates文件夾到Web應用程序/資源(和調整模板根)
•連接最多不同種類的模板解析器(例如FileTemplateResolver)
•在@Configuration文件中配置模板解析器,而不是讓春引導使用默認值,並application.properties

以下是我的pom.xml文件中的相關條目:

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

<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-devtools</artifactId> 
    <optional>true</optional> 
</dependency> 

有沒有我在這裏失蹤的東西?

+0

編輯完模板後,請使用'CTRL + F9'命令項目。 –

+0

@AbdullahKhan感謝您的快速響應:實際上,這是我在我的Mac上映射到⌘-S的命令(在我的原始文章中,我不準確地稱它爲「重建」),並且它沒有任何作用...仍然需要重新啓動服務器。 –

回答

1

萬一別人運行到這個問題,它是特定的IntelliJ:

我用下,啓動配置的「雄貓」模板。一旦我將其更改爲「Spring Boot」配置模板,其行爲如預期。