springboot 在idea中实现热部署的方法
作者:maybe_u_like_鱼香茄子 时间:2022-10-24 22:27:19
SpringBoot的web项目,在每一次修改了java文件或者是resource的时候,都必须去重启一下项目,这样的话浪费了很多的时间,实现了热部署,在每一次作了修改之后,都会自动的重启
第一步:引入热加载的插件,springboot 1.3开始就有的
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
project 中添加spring-boot-maven-plugin,主要在eclipse中起作用,idea不需要加此配置,springboot 项目的话,应该是有此配置,加里面的内容即可。
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
第二步 : idea设置(14版本)
1、点击: file ,Settings ,Build ,Execution,Deplment
然后记得apply,ok。
2、组合键:Shift+ALT+Ctrl+/ ,选择“Registry”,回车,找到“complier.automake.allow.when.app.running”
注意:
因为我的idea是14版本,有的15版本或者是更高的在compiler 里面是这样的:
然后快捷键是Ctrl + Shift +A ,一样找到complier.automake.allow.when.app.running,点击勾选即可。
第三步: 如果你用的浏览器和我的一样,那么就禁用缓存
按F12(更多工具—->开发者工具),找到network,勾选Disable Cache。
亲测有效。
另外,如果是eclipse的话,直接在pom.xml文件当中添加:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
即可,亲测有效
来源:https://blog.csdn.net/xusheng_Mr/article/details/78771746
标签:spring,boot,idea,热部署
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
详解WPF中用户控件和自定义控件的使用
2023-07-25 12:20:26
![](https://img.aspxhome.com/file/2023/3/129693_0s.png)
Windows同时安装两个版本JDK并实现动态切换JAVA8或JAVA11的方法
2022-05-20 05:38:41
![](https://img.aspxhome.com/file/2023/5/71945_0s.jpg)
android获取手机唯一标识的方法
2022-09-16 15:55:39
浅谈让@Value更方便的Spring自定义转换类
2023-10-06 14:01:02
![](https://img.aspxhome.com/file/2023/4/74754_0s.jpg)
浅谈SpringBoot中的@Conditional注解的使用
2021-12-07 16:47:04
![](https://img.aspxhome.com/file/2023/8/61798_0s.png)
浅谈JAVA并发之ReentrantLock
2022-10-22 10:03:33
![](https://img.aspxhome.com/file/2023/7/87367_0s.jpg)
解决Tomcat启动报异常java.lang.ClassNotFoundException问题
2023-07-27 03:33:01
![](https://img.aspxhome.com/file/2023/1/100061_0s.png)
Map与JavaBean相互转换的工具类
2021-09-22 20:59:02
C#文件合并的方法
2022-08-07 13:22:17
JavaWeb实现简单文件上传功能
2022-11-19 04:15:41
![](https://img.aspxhome.com/file/2023/1/86791_0s.jpg)
C#使用doggleReport生成pdf报表的方法
2022-12-29 14:55:28
Java 重命名 Excel 工作表并设置工作表标签颜色的示例代码
2023-02-22 15:35:34
![](https://img.aspxhome.com/file/2023/1/65211_0s.png)
浅谈抛出异常和捕获异常的一些区别
2023-10-19 15:25:24
Spring Boot JPA Repository之existsBy查询方法失效的解决
2023-01-27 18:36:10
Android 保存WebView中的图片示例
2021-10-05 21:57:05
Android实现渐变圆环、圆形进度条效果
2022-12-06 06:59:04
![](https://img.aspxhome.com/file/2023/4/137254_0s.jpg)
Gson之toJson和fromJson方法的具体使用
2021-07-20 16:28:47
![](https://img.aspxhome.com/file/2023/2/75512_0s.png)
Java Web开发之基于Session的购物商店实现方法
2023-06-09 20:46:35
Android UI实现SlidingMenu侧滑菜单效果
2021-12-08 16:03:34
![](https://img.aspxhome.com/file/2023/3/138363_0s.jpg)
SpringMVC底层执行流程及原理解析
2022-11-19 03:34:56
![](https://img.aspxhome.com/file/2023/5/62355_0s.png)