欢迎来到代码驿站!

当前位置:首页 >

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

时间:2020-08-30 16:00:17|栏目:|点击:

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

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

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

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

接着开始配置pom.xml文件

<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)

  #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/**

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

上一篇:asp .net core静态文件资源的深入讲解

栏    目:

下一篇:R语言ggplot2边框背景去除的实现

本文标题:Intellij IDEA实现springboot热部署过程解析

本文地址:http://www.codeinn.net/misctech/4266.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有