作者:普罗土 | 来源:互联网 | 2023-09-15 11:55
SpringCloud笔记-热部署Devtools配置
修改后端代码时,需要重新启动项目应用新的代码。为了减少重启项目的麻烦,我们可以配置热部署。
配置devtools到子工程的pom.xml: < dependency> < groupId> org.springframework.boot groupId> < artifactId> spring-boot-devtools artifactId> < scope> runtime scope> < optional> true optional> dependency>
添加配置到父工程的pom.xml: < build> < plugins> < plugin> < groupId> org.springframework.boot groupId> < artifactId> spring-boot-maven-plugin artifactId> < configuration> < fork> true fork> < addResources> true addResources> configuration> plugin> plugins> build>
修改idea设置,setting→Build,Execution,Deployment→Compiler勾选如下四个设置
注册设置
“ctrl
+shift
+alt
+/
”唤醒面板,点击注册
勾选该选项,idea2021版本无compiler.automake.allow.when.app.running,我们需要多做下面一步设置
settings→advanced settings 勾选下图内容,与勾选compiler.automake.allow.when.app.running是等价的。
重启idea,热部署配置完成。