码迷,mamicode.com
首页 > 其他好文 > 详细

sprinbboot 热部署 造成类加载器 不一致问题

时间:2018-11-04 15:34:56      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:running   pil   nbsp   get   ram   auto   ati   不用   registry   

这里只说devtools的方式,注意以下的热部署方式在IDEA是默认没有打开自动编译的,手动编译需要快捷键(Ctrl+Shift+F9),

自动编译的修改配置如下:(注意刷新不要太快,会有1-2秒延迟)

File-Settings-Compiler-Build Project automatically

二、spring-boot-devtools

在pom中直接引入依赖

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

设置以下两项(第一项如已设置直接设置第二项)

 

1) “File” -> “Settings” -> “Build,Execution,Deplyment” -> “Compiler”,选中打勾 “Build project automatically” 。

 

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

 

三、application配置

在application.yml配置中加入

spring:
#    热部署生效
  devtools:
    restart:
      enabled: true
      additional-paths: src/main/java
#      classpath目录下的WEB-INF文件夹内容修改不重启
      exclude: WEB-INF/**

 

 

 

之后就可以实现改变代码不用重启了!

sprinbboot 热部署 造成类加载器 不一致问题

标签:running   pil   nbsp   get   ram   auto   ati   不用   registry   

原文地址:https://www.cnblogs.com/javajetty/p/9903978.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!