Spring Boot Deployment
Spring Boot Deployment
build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.2.3.RELEASE'
+ classpath 'org.springframework:springloaded:1.2.1.RELEASE'
}
}
apply plugin: 'java'
apply plugin: 'spring-boot'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-web'
}
jar.baseName = 'spring-boot-sample'
Add org.springframework:springloaded:1.2.1.RELEASE to the buildscript dependencies. Then run gradle bootRun as usual to enable deployment.
When Using Thymeleaf
If you use Thymeleaf as the template engine, disable caching.
application.properties
spring.thymeleaf.cache=false
For template engines other than Thymeleaf, see this page.
When Using IntelliJ IDEA
Add the following to build.gradle.
build.gradle
apply plugin: 'idea'
idea {
module {
inheritOutputDirs = false
outputDir = file("$buildDir/classes/main/")
}
}
By default, IntelliJ writes compilation results to a different location from Gradle, which interferes with file monitoring. Change the relevant setting as shown above.
Reference: 80. Hot swapping