spring-boot-devtools 配置项目热部署

热部署成功之后,每次修改文件其实还是要等待几秒的,这个跟电脑的配置有关系,多刷新几次看看。

  1. 引入依赖

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    
  2. 修改配置文件

    # application.yaml
    spring:
      devtools:
        restart:
          enabled: true
      thymeleaf:
        cache: false
    
  3. 开启IDEA自动构建项目

posted @ 2021-09-29 11:30  Bin_x  阅读(43)  评论(0编辑  收藏  举报