This is necessary for hot deployment by rebuilding when launching the Spring Boot application with bootRun from Gradle.
To enable hot deploy, all you have to do is add dependent packages. The following is for Gradle.
build.gradle
compile 'org.springframework.boot:spring-boot-devtools'
When the class file output from Gradle is updated by the `` `classes``` command of gradle (gradlew depending on the environment), Spring Boot reloads the class file and hot deploys it.
Gradle's `bootJar```,
bootWar```, ``` build``` also executes the ``
classes command, so hot deployment is possible, but the code written simply If you just want to check the operation of Jar, the time of Jar and War output becomes overhead. Spring Boot is loading class files, not Jar, so classes are sufficient. (At this time, `` `test
does not work, so unit tests such as JUnit will not be executed.)
If you do a local Spring Boot with bootRun from Docker through local Gradle, you can hot deploy while receiving HTTP requests with Nginx etc. (Related article)
Recommended Posts