1.spring-boot-devtools
- 作用:一个开发者服务的模块,通过classLoader监听classpath下的变动,然后重启应用。
2.使用流程
2.1 添加spring-boot-devtools依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<!-- optional=true,依赖不会传递,-->
</dependency>
<scope></scope>
属性默认为compile
2.2 添加编译节点,打包
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<configuration>
<fork>true</fork>
</configuration>
</plugins>
</build>
3. 设置Intellij
- step1:
- ctrl+alt+s
- 搜索compiler
- 勾选build project automatically
- step2:
- Ctrl+Shift+Alt+ /
- 选中1.Registry
- 勾选compiler.automake.allow.when.app.running
4重启IntelliJ
(借鉴总结)