Intellij IDEA 实现springboot热部署

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

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

接着 Ctrl+Shift+Alt+/ 快捷键选择Registry会弹出以下图浏览器

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

接着开始配置pom.xml文件springboot

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

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

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

 

以上就是springboot热部署的流程,但愿对你们有所帮助!ide

相关文章
相关标签/搜索