Hot deploy with Spring Boot development

Overview

This is necessary for hot deployment by rebuilding when launching the Spring Boot application with bootRun from Gradle.

Add dependent packages

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'

Hot deploy with Gradle commands as triggers

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.

Procedure summary

  1. Add spring-boot-devtools to dependent packages
  2. Run bootRun on Gradle to start Spring Boot
  3. Run classes in Gradle and hot deploy to Spring Boot

By the way

Why Gradle build commands are classes

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.)

Through Docker

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

Hot deploy with Spring Boot development
Start web application development with Spring Boot
Download with Spring Boot
Create a Spring Boot development environment with docker
Generate barcode with Spring Boot
Hello World with Spring Boot
Implement GraphQL with Spring Boot
Get started with Spring boot
Hello World with Spring Boot!
Run LIFF with Spring Boot
SNS login with Spring Boot
Hot deploy with IntelliJ IDEA
Spring Boot Hot Swapping settings
File upload with Spring Boot
Spring Boot starting with copy
Spring Boot starting with Docker
Hello World with Spring Boot
Set cookies with Spring Boot
Use Spring JDBC with Spring Boot
Add module with Spring Boot
Getting Started with Spring Boot
Create microservices with Spring Boot
Send email with spring boot
Until you start development with Spring Boot in eclipse 1
Until you start development with Spring Boot in eclipse 2
Spring Boot application development in Eclipse
Create an app with Spring Boot 2
Database linkage with doma2 (Spring boot)
Spring Boot programming with VS Code
Until "Hello World" with Spring Boot
Inquiry application creation with Spring Boot
Get validation results with Spring Boot
(Intellij) Hello World with Spring Boot
Create an app with Spring Boot
Google Cloud Platform with Spring Boot 2.0.0
Check date correlation with Spring Boot
I tried GraphQL with Spring Boot
[Java] LINE integration with Spring Boot
Beginning with Spring Boot 0. Use Spring CLI
I tried Flyway with Spring Boot
Domain Driven Development with Java and Spring Boot ~ Layers and Modules ~
Message cooperation started with Spring Boot
Spring Boot gradle build with Docker
Processing at application startup with Spring Boot
Create Spring Boot development environment on Vagrant
Hello World with Eclipse + Spring Boot + Maven
Send regular notifications with LineNotify + Spring Boot
Perform transaction confirmation test with Spring Boot
HTTPS with Spring Boot and Let's Encrypt
Create Spring Boot-gradle-mysql development environment with Docker
Try using Spring Boot with VS Code
Launch Nginx + Spring Boot application with docker-compose
Spring Boot + Docker Java development environment construction
I tried Lazy Initialization with Spring Boot 2.2.0
Implement CRUD with Spring Boot + Thymeleaf + MySQL
Asynchronous processing with Spring Boot using @Async
Implement paging function with Spring Boot + Thymeleaf
(IntelliJ + gradle) Hello World with Spring Boot
Use cache with EhCashe 2.x with Spring Boot
Form class validation test with Spring Boot
Run WEB application with Spring Boot + Thymeleaf