spring boot 热部署 实现 前端部分热更新 详细操作

来源:https://www.cnblogs.com/c2g5201314/p/13063510.html

  1. 导入依赖包
 <!-- 热修改前端-->
 <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional> <!-- 这个需要为 true 热部署才有效 -->
</dependency>
  1. 操作步骤 : File >> Settings >>Build, Execution, Deployment >> Compiler ,

勾上“”Build project automatically"这个选框,保存

在这里插入图片描述

  1. 按住ctrl + alt+ shift + /, 选择第一个Registry
    在这里插入图片描述

  2. 在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
6. 部分浏览器需要关闭浏览器的缓存,才能及时刷新前端页面

关闭浏览器的缓存文件功能,我是使用谷歌的chome

那么就把disable cache勾选 ,其他浏览器也需要关闭的,这里就不展示。

关闭浏览器的缓存文件功能,我是使用谷歌的chome

那么就把disable cache勾选 ,其他浏览器也需要关闭的,这里就不展示。

该方式仅能修改热更新前端 ,如 js,jsp,html.css等.

java后端部分无法热更新,需要插件Jrebel才可以

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Spring Boot提供了一个非常方便的开发工具包,即spring-boot-devtools,它可以实现热更新功能。您可以通过在项目的pom.xml文件中添加以下依赖来导入spring-boot-devtools: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <!-- 这个需要为 true 热部署才有效 --> </dependency> ``` 同时,您还需要根据您使用的IDE进行一些设置,以确保热更新的功能正常工作。对于使用IDEA的用户,可以按照以下步骤进行设置: 1. 设置控制台的自动显示:在IDEA的设置中,找到"Build, Execution, Deployment" -> "Compiler",勾选"Make project automatically"选项。 2. 注册自动编译事件:在IDEA的设置中,找到"Build, Execution, Deployment" -> "Compiler" -> "Build project automatically",确保该选项被勾选。 3. 自动更新项目文件:在IDEA的设置中,找到"Build, Execution, Deployment" -> "Compiler" -> "Build project automatically",勾选"Build project automatically"选项。 通过以上设置,您就可以在进行代码修改后实现Spring Boot项目的热更新了。您可以通过手动保存文件或者进行代码编辑时自动保存文件来触发热更新功能。请注意,热更新只在开发环境中起作用,不适用于生产环境。 希望以上信息对您有帮助!如果您还有任何问题,请随时向我提问。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [spring boot 热部署 实现 前端部分热更新 详细操作](https://blog.csdn.net/weixin_41040132/article/details/128610089)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [[实用]Spring Boot热部署/热更新](https://blog.csdn.net/qq_29023593/article/details/123218225)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值