这个是idea版本
1.项目中pom.xml中添加依赖和插件
依赖
<!-- spring-boot-devtools --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-devtools</artifactId><optional>true</optional> <!-- 表示依赖不会传递 --></dependency>
插件
<plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><fork>true</fork> <!-- 如果没有该配置,devtools不会生效 --></configuration></plugin></plugins>
2.设置自动编译
File-Settings-Compiler-Build Project automatically
3.Ctrl+Shift+Alt+/
打开后找到Compiler autoMake allow when app running
4.设置项目的启动加载
Run->Edit Configuration
找到spring boot下的 On ‘Update’ action 和 On frame deactivation ,选择 Update classes and resources
这样就部署成功了
如果还不可以那就再安装个插件JRebel
安装:
在线GUID地址:在线生成GUID
生成地址:/
如果失效刷新GUID替换就可以了
打开jrebel 如下所示面板,选择Connect to online licensing service
第一行粘贴GUID
第二行输入邮箱
这样修改完Java代码后,就可以通过快捷键 Ctrl+shift+F9 而不再需要重启站点这样繁琐浪费时间的操作了
设置成离线工作模式
点击之后变成
这样就完成了
启动项目如下,第二哥就是debug运行。