您的位置:首页 > 编程语言 > Java开发

关于SpringBoot在idea中实现热部署

2017-10-29 09:46 543 查看

关于SpringBoot在idea中实现热部署

注意:开启热部署后不要频繁ctrl+s保存,因为一旦保存就会重新部署,你只需要在需要的时候ctrl+s即可,jrebel中可以设置自动部署的间隔时间,可是dev-tools就不清楚了

SpringBoot项目中

在pom.xml中

dependencies标签中

<!--springBoot工程实现热部署-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>


build->plugins标签中

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork><!--注意要修改这里-->
</configuration>
</plugin>


application.properties/application.yml中

Thymeleaf,Freemarker,Groovy,Velocity等视图页面禁用缓存

spring.thymeleaf.cache=false
spring.freemarker.cache=false
spring.groovy.template.cache=false
spring.velocity.cache=false


IDEA中

开启自动编译

File->Other Settings->Default Settings找到全局设置界面 ->

Build,Execution,Deployment -> Compiler -> 勾选 Make project automatically(only works while not running / debugging)

修改idea行为

CTRL + SHIFT + A –>输入并进入Registry–>勾选 compiler.automake.allow.when.app.running

Google Chrom浏览器中

禁用缓存

CTRL+SHIIFT+J进入开发者界面中 -> Network 选项 -> 勾选Disable cache
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  idea