IDEA development springboot use hot deployment (very detailed)

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
Here Insert Picture Description
then hello instead hello2, preservation, control can be seen directly from the restart, again visit HTTP: // localhost: 8080 / hello , consoles display hello2
Here Insert Picture Description

If it can not be used, use my code and your comparison.
Code Address: http://download.csdn.net/download/m0_45025658/12248980

Published 33 original articles · won praise 1 · views 2045

Guess you like

Origin blog.csdn.net/m0_45025658/article/details/104859898