IDEA 中 Spring Boot 启用热部署

Posted To be a better Programer...

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了IDEA 中 Spring Boot 启用热部署相关的知识,希望对你有一定的参考价值。

maven 配置

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <groupId>cn.globalrave</groupId>
   <artifactId>bars</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <packaging>jar</packaging>
   <name>bars</name>
   <description>Bars project for Spring Boot</description>

   <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>1.5.6.RELEASE</version>
   </parent>

   <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
      <java.version>1.8</java.version>
   </properties>

   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-aop</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-cache</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-freemarker</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-web</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-websocket</artifactId>
      </dependency>

      <!-- spring-boot-devtools 是一个为开发者工具-->
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-devtools</artifactId>
         <scope>runtime</scope>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-test</artifactId>
         <scope>test</scope>
      </dependency>
   </dependencies>
   <build>
      <plugins>
         <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <!--热部署配置-->
            <configuration>
               <fork>true</fork>
            </configuration>
         </plugin>
      </plugins>
   </build>
</project>
IDEA 配置
  • CTRL + SHIFT + A 查找 勾选 make project automatically
  • ctrl+shift+alt+/ 查找Registry 勾选compiler.automake.allow.when.app.running

以上是关于IDEA 中 Spring Boot 启用热部署的主要内容,如果未能解决你的问题,请参考以下文章

IDEA中Spring boot配置热部署无效问题解决方式(转)

Intellij IDEA 设置Spring Boot热部署

spring-boot-devtools在Idea中热部署方法

Intellig IDEA 搭建spring boot 热部署

IDEA2021.3 开发Spring Boot配置热部署

IDEA2021.3 开发Spring Boot配置热部署