SpringBoot如何进行高效热重启配置设置?

2026-05-28 11:361阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计471个文字,预计阅读时间需要2分钟。

SpringBoot如何进行高效热重启配置设置?

1. 添加依赖 - `groupId`: org.springframework.boot - `artifactId`: spring-boot-devtools - `optional`: true - `scope`: runtime - 注意:不能被其他模块继承,多个子模块可去除`optional`。

1.添加依赖

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> 不能被其它模块继承,如果多个子模块可以去掉 不必须 <scope>runtime</scope> 只在运行时起作用 打包时不打进去 </dependency>

安装成功后查看maven 依赖 如果存在spring-boot-devtools 并且没有红线证明成功添加

2.要重新编译项目

SpringBoot如何进行高效热重启配置设置?

重启服务器

idea:

设置File ->Setting ->Compile: 勾选“Build project automatically”选项

知识点补充:

SpringBoot热启动

在pom文件中添加maven依赖

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <scope>true</scope> </dependency>

在 < build> 下面 < plugins> 里的添加如下代码

<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <!--热部署配置--> <configuration> <!--fork:如果没有该项配置,整个devtools不会起作用--> <fork>true</fork> </configuration> </plugin> </plugins> </build>

File --> Setting --> complier -->勾选Build Project automatically

快捷键 ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running (编译器自动允许当应用程序运行)

此时大功告成,修改代码后,不用重启程序访问的也是修改后的内容,若没效果,可稍等片刻。

以上就是易盾网络小编整理的全部内容,希望能够帮助到大家。

本文共计471个文字,预计阅读时间需要2分钟。

SpringBoot如何进行高效热重启配置设置?

1. 添加依赖 - `groupId`: org.springframework.boot - `artifactId`: spring-boot-devtools - `optional`: true - `scope`: runtime - 注意:不能被其他模块继承,多个子模块可去除`optional`。

1.添加依赖

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> 不能被其它模块继承,如果多个子模块可以去掉 不必须 <scope>runtime</scope> 只在运行时起作用 打包时不打进去 </dependency>

安装成功后查看maven 依赖 如果存在spring-boot-devtools 并且没有红线证明成功添加

2.要重新编译项目

SpringBoot如何进行高效热重启配置设置?

重启服务器

idea:

设置File ->Setting ->Compile: 勾选“Build project automatically”选项

知识点补充:

SpringBoot热启动

在pom文件中添加maven依赖

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <scope>true</scope> </dependency>

在 < build> 下面 < plugins> 里的添加如下代码

<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <!--热部署配置--> <configuration> <!--fork:如果没有该项配置,整个devtools不会起作用--> <fork>true</fork> </configuration> </plugin> </plugins> </build>

File --> Setting --> complier -->勾选Build Project automatically

快捷键 ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running (编译器自动允许当应用程序运行)

此时大功告成,修改代码后,不用重启程序访问的也是修改后的内容,若没效果,可稍等片刻。

以上就是易盾网络小编整理的全部内容,希望能够帮助到大家。