springBoot 项目热部署的方案之spring-boot-devtools

添加依赖

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <!-- 有人说optional一定要配置成true才有效, 但我调试完感觉不加optional也有效-->
            <optional>true</optional> 
 </dependency>

配置文件 :

#热部署默认会重启  
spring.devtools.restart.enabled=true  
#添加那个目录的文件需要restart  
spring.devtools.restart.additional-paths=src/main/java  
#排除那个目录的文件不需要restart  
spring.devtools.restart.exclude=static/**,public/**
  devtools:
    restart:
      enabled: true
      additional-paths: src/main/java
      exclude: static/**,public/**

优点:简单,支持Spring-boot项目,支持成员级别的修改热部署。

缺点:只支持spring-boot项目。

相关: application.properties配置

完美解决!

评论

暂无评论