A hot deployment allows you to load changed code after modifying the code without restarting the server.
1th: Modify the server configuration so that when the idea window loses focus, the class and resources are updated
Menu Run-editconfiguration, then configure the specified server under the Right Server tab under on frame deactivation = Update classes and resource.
Advantages: Simple
Disadvantage: The hot load based on the JVM only supports code modifications within the method block, only in debug mode, and when the idea loses focus, the heat loads and the relative loading speed is slow
2nd: Use the springloaded jar package A. Download the jar package, github:https://github.com/spring-projects/spring-loaded
B. Adding a VM startup parameter when you start an app:-javaagent:/home/lkqm/.m2/repository/org/springframework/springloaded/1.2.7.release/ Springloaded-1.2.7.release.jar-noverify
Pros: Support for the Spring Series framework (without spring boot), support for member-level modifications (Redaction methods, fields, annotations), support for enumeration set of values.
Cons: Relative to merit
3rd: Using the developer tools provided by Spring-boot-devtools
The following dependencies are introduced in the Spring-boot project
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId> Spring-boot-devtools</artifactid>
</dependency>
Pros: Simple, support for spring-boot projects, support for member-level modification of hot deployments.
Cons: Only spring-boot projects are supported.
4th: Use the Jrebel plugin for hot deployment (14-day free trial of the plugin)
Online Installation: Menu file, Setting, Plugin, click on the bottom right of the Browse repositories, the top of the popup box input: jreble for Intellij, select Install.
Pros: Powerful, support for various frameworks, and the way to provide IDE plugins.
The last 3 methods are based on the class loading mechanism to implement the hot load, so you have to modify the completion code after the current code must be recompiled to trigger a hot deployment, Eclipse supports automatic compilation by default, and in IntelliJ idea, the default is to turn off automatic compilation, you can follow the following 2 steps to open: Idea Open Project Auto compile, go to Settings, Build,execut, Deployment, Compiler tick the Build project automatically idea on the left to turn on automatic make, CTRL + SHIFT + A SEARCH command: registry, tick Compiler.automake.allow.when.app.running