idea工具 spring boot框架实现热部署,自动编译

  1:在pom.xml 中 配置

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
</dependency>

注意:并不是pom.xml 的<build>标签中

 

如果我们想指定让 devtools 监听指定文件夹,那么可以在 application.yml 配置
spring.devtools.restart.additional-paths=your path,注意这里需要改成 yml 文件的格式。

2: 如果有页面的话 禁止页面缓存

spring:
  application:
    name: XXX
  aop:
    proxy-target-class: true
  thymeleaf:
      cache: false
      prefix: classpath:/templates/
      mode: LEGACYHTML5
3:开idea工具的自动编译功能

最后 组合键:“Shift+Ctrl+Alt+/” ,选择 “Registry” ,选中打勾 “compiler.automake.allow.when.app.running” 。

完成以上步骤 即可实现SpringBoot项目自动编译+热部署,这我们修改后的代码能够立刻看到效果,提高效率

 


posted @ 2018-03-27 20:30  你的名称已被使用  阅读(2610)  评论(0编辑  收藏  举报