Spring Boot hot deployment
1. SpringBoot hot deployment overview
We repeatedly modify resources such as classes and pages during development. After each modification, we need to restart it to take effect. This makes every startup troublesome and wastes a lot of time. We can modify the code and it will take effect without restarting. This function can be achieved by adding configuration in pom.xml, which we call hot deployment.
2. SpringBoot project hot deployment
pom.xml hot deployment dependencies:
<!--热部署配置-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
3.IDEA SpringBoot hot deployment fails
If you have added the above dependencies and still cannot hot-deploy after starting the service, it may be that automatic compilation is not performed by default in IDEA . This is not a problem of hot deployment, so we need to set up automatic compilation of IDEA.
-
Open IDEA, press ctrl + alt + s, open the settings page window, and find the build... window
-
Find the compiler window and check Automatically compile the project
-
Then Shift+Ctrl+Alt+/, select Registry
-
Then find the compiler.automake.allow.when.app.running option and check it, which means that the code will be automatically compiled when the app starts.
OK, at this point IDEA's settings for automatic compilation are complete.