1.添加devtools 依赖到工程项目中:
2添加一个插件到pom文件中:
<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>
3在idea工具中开启相应的配置: file-- settings --build ---compiler 打开后将以下四个选项选中
4开启快捷键: ctrl+alt+shift +/ 选中registry
选中下面的compiler running 和 ffromedt选项 选中
5重启idea工具 每次修改就自动重新部署(开发时后开启)
6.在项目发布时应该关闭:
在yml文件配置 spring.devtools.restart.enabled: false