Every time something a little tinkering, you will want to restart after using hot deployment, once changed, it can be automatically restarted
One. First, add dependencies
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
two. Then modify the settings IDEA
- File” -> “Settings” -> “Build,Execution,Deplyment” -> “Compiler”,选中打勾 “Build project automatically”
- Key combination: "Shift + Ctrl + Alt + /", select the "Registry", select the tick "compiler.automake.allow.when.app.running"
three. Restart IDEA
four. Observe the effect
first to write a control layer
@RestController
public class HelloController {
@RequestMapping("/hello")
public String hello() {
System.out.println("hello1");
}
}
Manual operation, visit HTTP: // localhost: 8080 / hello , console output hello1
then hello instead hello2, preservation, control can be seen directly from the restart, again visit HTTP: // localhost: 8080 / hello , consoles display hello2
If it can not be used, use my code and your comparison.
Code Address: http://download.csdn.net/download/m0_45025658/12248980