网站首页 > 博客文章 正文
在开发过程中,每修改代码会比较频繁启动、停止微服务动作,如果是热部署速度比手动停止后再启动更快,并且可以提高开发效率一定程度上专心敲代码。
热部署开发实现步骤
1、在微服务模块pom.xml添加 maven 引用包
<!-- SpringBoot自带热加载开发工具 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>2.3</version> </dependency>
2、设置 idea 属性
“File” -> “Settings” -> “Build,Execution,Deplyment” -> “Compiler”,选中打勾 “Build project automatically” 。
组合键:“Shift+Ctrl+Alt+/” ,选择 “Registry” ,选中打勾 “compiler.automake.allow.when.app.running” 。
3、Chrome禁用缓存
F12(或Ctrl+Shift+J或Ctrl+Shift+I)--> NetWork --> Disable Cache(while DevTools is open)
至此,在idea中修改代码,修改后可以及时看到效果,无须手动重启和清除浏览器缓存。
测试方法
1.修改代码类-->保存:应用会重启
2.修改配置文件-->保存:应用会重启
3.修改页面-->保存:应用会重启,页面会刷新(需在yml文件中将spring.thymeleaf.cache设为false
不能使用分析
1.对应的spring-boot版本是否正确。
2.Intellij IDEA是否开启了Make Project Automatically。
3.是否加入plugin了,以及属性<fork>true</fork>。
4.如果设置SpringApplication.setRegisterShutdownHook(false),则自动重启将不起作用。
猜你喜欢
- 2024-09-18 阿里p7大佬首次分享Spring Cloud学习笔记,带你从0搭建微服务
- 2024-09-18 如何使用 SpringCloud 搭建服务注册中心?
- 2024-09-18 springcloud-microservice 快速构建分布式系统
- 2024-09-18 Eureka搭建分布式SpringCloud项目
- 2024-09-18 Spring Cloud 微服务实战——nacos 服务注册中心搭建(附源码)
- 2024-09-18 Spring cloud + vue + oAuth2.0搭建企业级微服务项目源码分享
- 2024-09-18 Nacos + Spring Cloud Gateway动态路由配置
- 2024-09-18 快速创建 Spring Cloud 应用的 Spring Initializr 使用及原理
- 2024-09-18 Spring Cloud 整合 SkyWalking(spring cloud 整合kafka设置日志级别)
- 2024-09-18 记录Spring Cloud应用在阿里云架构的一次部署
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- powershellfor (55)
- messagesource (56)
- aspose.pdf破解版 (56)
- promise.race (63)
- 2019cad序列号和密钥激活码 (62)
- window.performance (66)
- qt删除文件夹 (72)
- mysqlcaching_sha2_password (64)
- ubuntu升级gcc (58)
- nacos启动失败 (64)
- ssh-add (70)
- jwt漏洞 (58)
- macos14下载 (58)
- yarnnode (62)
- abstractqueuedsynchronizer (64)
- source~/.bashrc没有那个文件或目录 (65)
- springboot整合activiti工作流 (70)
- jmeter插件下载 (61)
- 抓包分析 (60)
- idea创建mavenweb项目 (65)
- vue回到顶部 (57)
- qcombobox样式表 (68)
- vue数组concat (56)
- tomcatundertow (58)
- pastemac (61)
本文暂时没有评论,来添加一个吧(●'◡'●)