我创建了一个使用Thymeleaf的Spring Boot Gradle项目.我的IDE是IntelliJ.我在根文件夹中创建了一个application.properties:
spring.resources.cache-period=0
spring.thymeleaf.cache=false
spring.thymeleaf.mode=LEGACYHTML5
Run Code Online (Sandbox Code Playgroud)
但不知何故,它仍然没有自动重装.我必须先点击"制作项目"按钮.我有另一个项目,具有相同的配置(不确定IntelliJ设置)奇怪的是,确实可以刷新.
正在读取我的application.properties,因为我可以使用@Value注释来提取自定义属性.
作为参考,我的build.gradle
buildscript {
ext {
springBootVersion = '1.3.1.RELEASE'
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.springframework:springloaded:1.2.5.RELEASE")
}
}
apply plugin: 'spring-boot'
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.8
targetCompatibility = 1.8
idea {
module {
inheritOutputDirs = false
outputDir = file("$buildDir/classes/main/")
}
}
jar {
baseName = 'earthalive'
version = ""
}
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
testCompile('org.springframework.boot:spring-boot-starter-test')
compile('net.sourceforge.nekohtml:nekohtml:1.9.22')
}
task wrapper(type: Wrapper) {
gradleVersion …Run Code Online (Sandbox Code Playgroud)