【发布时间】:2016-04-11 20:11:29
【问题描述】:
我创建了一个使用 Thymeleaf 的 Spring Boot Gradle 项目。我的 IDE 是 IntelliJ。我在根文件夹中创建了一个 application.properties:
spring.resources.cache-period=0
spring.thymeleaf.cache=false
spring.thymeleaf.mode=LEGACYHTML5
但不知何故,它仍然没有自动重新加载。我必须先点击“制作项目”按钮。我有另一个项目,具有相同的配置(不确定 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 = '2.9'
}
想法?
【问题讨论】:
标签: intellij-idea gradle spring-boot thymeleaf