天天看点

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开发者选项中,关闭浏览器缓存,便于调试。

继续阅读