SpringBoot项目使用dev-tool实现热部署

1、pom文件添加依赖包

 <dependency>
	 <groupId>org.springframework.bootgroupId>
	 <artifactId>spring-boot-devtoolsartifactId>
	 <optional>trueoptional>
 dependency>
 
<build>
	 <plugins>
		 <plugin>
			 <groupId>org.springframework.bootgroupId>
			 <artifactId>spring-boot-maven-pluginartifactId>
			 <configuration>
				 <fork>truefork>
			 configuration>
		 plugin>
	 plugins>
 build>

2、IDEA配置

  • 打开IDEA的设置:

SpringBoot项目使用dev-tool实现热部署_第1张图片

  • 勾选【Build project automatically】:

SpringBoot项目使用dev-tool实现热部署_第2张图片

  • 使⽤快捷键打开,选择Registry:

IDEA默认快捷键:
window快捷键 Shift+Ctrl+Alt+/
mac快捷键 Shift+Command+Alt+/
SpringBoot项目使用dev-tool实现热部署_第3张图片

  • 在弹出的框中选择【compiler.automake.allow.when.app.running 】,若下图:

SpringBoot项目使用dev-tool实现热部署_第4张图片

  • 最后重启IDEA就OK啦!

你可能感兴趣的:(IDEA,intellij,idea,开发工具)