Intellij IDEA实现springboot热部署过程解析

2025-05-29 0 26

对于springboot热部署貌似是这样的,首先要设置idea相关配置

导航栏 File -> Settings -> Build,Execution,Deployment -> Compiler 选择Build project automatically 打勾 如下图所示

Intellij IDEA实现springboot热部署过程解析

接着Ctrl+Shift+Alt+/ 快捷键选择Registry会弹出如下图

Intellij IDEA实现springboot热部署过程解析

在红色选择的一行打勾,就完成了这步骤。

接着开始配置pom.xml文件

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21
<dependencies>

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-devtools</artifactId>

<optional>true</optional>

</dependency>

</dependencies>

<build>

<plugins>

<!-- springboot maven plugin -->

<plugin>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-maven-plugin</artifactId>

<configuration>

<!--fork : 如果没有该项配置,肯定devtools不会起作用,即应用不会restart -->

<fork>true</fork>

</configuration>

</plugin>

</plugins>

</build>

pom文件也配置好了,就开始配置application.yml (或者 application.properties)

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16
#THYMELEAF

spring:

thymeleaf:

cache: false #这里一定要设置false

prefix: classpath:/thymeleaf/

suffix: .html

mode: HTML5

encoding: UTF-8

devtools:

   restart:

     #热部署生效true

     enabled: true

   #设置重启的目录

   additional-paths: resources/**,static/**,templates/**

     #该目录下的内容修改不重启

  exclude: data/**

配置完之后,基本上就可以运行了,还有最后要记得浏览器要设置 禁止缓存

Intellij IDEA实现springboot热部署过程解析

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持快网idc。

原文链接:https://www.cnblogs.com/zrl66/p/11423599.html

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

快网idc优惠网 建站教程 Intellij IDEA实现springboot热部署过程解析 https://www.kuaiidc.com/118040.html

相关文章

发表评论
暂无评论