1.在pom.xml中添加依赖
<!--devtools热部署--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <scope>true</scope> </dependency>
2.修改application.properties文件
spring: devtools: #热部署 restart: enabled: true additional-paths: src/main/java/com/plus #SpringBootApplication所在的路径 additional-exclude: WEB-INF/**
3.idea的修改
3.1:File-Settings-Compiler-Build Project automatically
3.2:ctrl + shift + alt + /然后选择Registry,勾上 Compiler.autoMake.allow.when.app.running
4、测试
- 修改类–>保存:应用会重启
- 修改配置文件–>保存:应用会重启
- 修改页面–>保存:应用不会重启,但会重新加载,页面会刷新
标签:SpringBoot,启动,部署,spring,重启,修改,devtools,true,additional From: https://www.cnblogs.com/privateLogs/p/17913753.html