IDEA中开启SpringBoot热部署

一、pom文件引入devtools依赖

 	<!-- devtools 热部署 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<optional>true</optional>
		</dependency>

二、application.properties文件中添加devtools配置

# 开启热部署
spring.devtools.restart.enabled=true
# 需要重新加载的目录
spring.devtools.restart.additional-paths=src/main/java
# 指定目录不更新
spring.devtools.restart.exclude=static/**

三、IDEA设置

(一)在Compiler中勾选Build project automatically

(二)IDEA在运行时自动编译加载选项

新版本:在设置里的Advanced Settings中勾选Allow auto-make to start even if developed application is currently running选项:

旧版本:按Ctrl+Shift+Alt+/键,点击Register,勾选compiler.automake.allow.when.app.running复选框(新版本的这个选项移位置了,参考上面)

posted @ 2024-05-30 19:15  taoA  阅读(942)  评论(0)    收藏  举报