spring boot(二) spring boot实现热部署
1.pom.xml文件添加
<!-- 热部署 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope>
</dependency>
<configuration>
<!-- 没有该配置,devtools 不生效 -->
<fork>true</fork>
<addResources>true</addResources>
</configuration>
File 》 Settings 》 Build,Execution,Deplyment 》 Compiler,选择 “Build project automatically”
快捷键“Shift+Ctrl+Alt+/” ,选择 “Registry” ,选择 “compiler.automake.allow.when.app.running” (已经选择过的跳过)
- 在controller中修改代码,保存,控制台就会有重新部署的信息,打开浏览器验证即可