惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
博客园 - 聂微东
Application and Cybersecurity Blog
Application and Cybersecurity Blog
MyScale Blog
MyScale Blog
罗磊的独立博客
H
Help Net Security
L
LangChain Blog
T
Threat Research - Cisco Blogs
量子位
S
Securelist
Last Week in AI
Last Week in AI
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
P
Privacy International News Feed
The Hacker News
The Hacker News
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Blog of Author Tim Ferriss
T
Threatpost
Security Latest
Security Latest
P
Palo Alto Networks Blog
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
F
Full Disclosure
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Heimdal Security Blog
J
Java Code Geeks
Recorded Future
Recorded Future
Hugging Face - Blog
Hugging Face - Blog
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
B
Blog RSS Feed
月光博客
月光博客
C
Cisco Blogs
V
Visual Studio Blog
D
DataBreaches.Net
H
Hacker News: Front Page
博客园 - 叶小钗
N
News and Events Feed by Topic
爱范儿
爱范儿
A
Arctic Wolf

博客园 - 快乐就好

vs code使用 mvn install 使用winsw部署spring boot项目 springboot jrebel热部署 浅谈单元测试 IntelliJ IDEA live template 方法配置 使用MHA实现MySQL主从复制高可用 Linux 常用命令介绍 开源堡垒机 dubbo循序渐进 - Jenkins自动化部署 maven教程 Git命令速查表 maven下载,上传设置 Maven中 jar包冲突原理与解决办法 延迟调度总结 使用Nexus3搭建Maven私服+上传第三方jar包到本地maven仓库 dubbo循序渐进 - 使用Docker安装Nexus dubbo循序渐进 - nacos安装 dubbo循序渐进 - 什么是RPC
springboot devtools热启动
快乐就好 · 2020-10-25 · via 博客园 - 快乐就好

热加载在pom.xml中添加devtools的maven引用,同时在plugin中添加devtools生效标志

 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <version>2.2.5.RELEASE</version>
 </dependency>
        
 <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <fork>true</fork>  <!-- 如果没有该生效标志,热部署的devtools不生效 -->
    </configuration>
</plugin>

2、Idea设置

于热部署是监听 Class 文件的变化,它自身不会主动去编译 Java 文件,所以我们得在 Java 文件改动时,自动编译成 Class 文件,然后热部署工具创造的新的类加载器才会加载改变后的 Class 文件。

所以,如果你使用 IDEA 开发工具的话,记得要把自动编译打开。

File | Settings | Build, Execution, Deployment | Compiler :该√的√上

在这里插入图片描述

3、修改IDEA的 Registry

开启自动编译,还差一步。

所以,如果你使用 IDEA 开发工具的话,记得要把自动编译打开。

再执行 shift+ctrl+alt+/ 快捷键
在这里插入图片描述

在这里插入图片描述

在配置文件application.yml

热部署生效:在配置文件application.yml中添加 :

spring:
  devtools:
    restart:
      enabled: true#设置开启热部署 默认true
    remote:
      restart:
        enabled: true #设置开启远程热部署

4 重启idea,运行工程

注意:这种配置启动不能直接运行 main 方法了,需要使用 mvn spring-boot:run 启动,

运行:mvn clean spring-boot:run

问题:

springBoot框架 只是实现了热启动而已,从控制台日志就可以看出来。