天天看點

springboot 熱部署springboot 熱部署

springboot 熱部署

  1. 打開設定 --> 查找 build project automatically --> 選中
  2. 打開設定 --> 查找Registry --> 找到并勾選compiler.automake.allow.when.app.running
如果沒有這個配置項(新版本沒有):
	 打開設定 --> 查找Registry--->進入keymap 設定Registry  快捷鍵
	 找到并勾選compiler.automake.allow.when.app.running
           
  1. 然後重新開機idea
  2. 引入 jar 依賴
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
</dependency>
           
  1. 引入插件
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
               <configuration>
                   <fork>true</fork>
               </configuration>
        </plugin>
    </plugins>
</build>
           
  1. application.properties 裡添加
spring.devtools.restart.enabled=true
           

以上操作之後,熱部署配置成功,建議在 google開發者選項中,關閉浏覽器緩存,便于調試。

繼續閱讀