[Spring Boot] IDEA project 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.

  1. Open IDEA, press ctrl + alt + s, open the settings page window, and find the build... window
    Insert image description here

  2. Find the compiler window and check Automatically compile the project
    Insert image description here

  3. Then Shift+Ctrl+Alt+/, select Registry
    Insert image description here

  4. 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.
    Insert image description here
    OK, at this point IDEA's settings for automatic compilation are complete.

Guess you like

Origin blog.csdn.net/cjl836735455/article/details/109274410