Intellij IDEA 4种配置热部署的方法:

热部署可以使的修改代码后,无须重启服务器,就可以加载更改的代码。

第1种:修改服务器配置,使得IDEA窗口失去焦点时,更新类和资源

菜单Run -> EditConfiguration , 然后配置指定服务器下,右侧server标签下on frame deactivation = Update classes and resource。

优点:简单

缺点:基于JVM提供的热加载仅支持方法块内代码修改,只有debug模式下,并且是在idea失去焦点时才会出发热加载,相对加载速度缓慢

第2种:使用springloaded jar包

a. 下载jar包,github:https://github.com/spring-projects/spring-loaded
b. 启动应用时添加VM启动参数:-javaagent:/home/lkqm/.m2/repository/org/springframework/springloaded/1.2.7.RELEASE/springloaded-1.2.7.RELEASE.jar -noverify

优点:对Spring系列框架支持好(不含Spring boot), 支持 成员级别的修改(增删改方法、字段、注解),支持对枚举值集。

缺点:与优点相对

第3种:使用spring-boot-devtools提供的开发者工具

spring-boot项目中引入如下依赖

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
优点:简单,支持Spring-boot项目,支持成员级别的修改热部署。

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

第4种:使用Jrebel插件实现热部署(该插件14天免费试用)

在线安装:菜单File -> Setting -> Plugin, 点击右侧底部 Browse repositories, 弹出框顶部输入:JReble for Intellij, 选中安装即可。

优点:强大,对各类框架支持,并且提供IDE插件的方式。

/**
* 使用intelliJ idea 不会默认重新编译当前代码
*/
最后3种方法是基于类加载机制来实现热加载的,因此你修改完成代码后必须重新编译当前代码,才能触发热部署。
Eclipse默认就支持了自动编译,而在Intellij IDEA中默认是关闭了自动编译的,可以按照如下2步设置开启:

/**
*Intellij IDEA 开启自动编译
*/
1.IDEA开启项目自动编译,进入设置,Build,Execut, Deployment -> Compiler 勾选中左侧的Build Project automatically
2.IDEA开启项目运行时自动make, ctrl + shift + a搜索命令:registry -> 勾选compiler.automake.allow.when.app.running
出现问题:修改后重新加载之后,不能访问
解决方法(不知道是否正确)在Compiler中全部勾选,最好是用Debug运行项目

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

IntelliJ IDEA热部署配置总结的更多相关文章

  1. Tomcat7 + JRebel6.3.0 + IntelliJ idea 热部署配置过程+错误分析

    以前使用Tomcat的时候直接就可以热部署,现在换了一个使用Spring框架的项目突然就不能热部署了. 网上说在tomcat里conf/context.xml中加入 <Context antiJ ...

  2. IntelliJ IDEA - 热部署插件JRebel ,对静态资源文件进行热部署?javascript、css、vm文件

    IntelliJ IDEA - 热部署插件JRebel ,对静态资源文件进行热部署?javascript.css.vm文件https://blog.csdn.net/feng_pump/article ...

  3. Jrebel热部署配置完整教程(IntelliJ IDEA、Jrebel、spring boot、springboot、eclipse、Tomcat)

    标签:IntelliJ IDEA.Jrebel.spring boot.springboot.eclipse.Tomcat1.安装插件并激活插件安装参考:http://blog.csdn.net/u0 ...

  4. IntelliJ IDEA - 热部署插件JRebel 安装使用教程

    IntelliJ IDEA - JRebel 安装使用教程 JRebel 能做什么? JRebel 是一款热部署插件.当你的 Java-web 项目在 tomcat 中 run/debug 的时候 , ...

  5. 安装IntelliJ IDEA热部署tomcat插件JreBel

    最近试着使用IntelliJ IDEA这款IDE,网上说它是最好用的java开发工具~但奈何国内ecilpse市场占有率实在稳固,所以国内这个工具也就少数人在使用 当然使用起来跟ecilpse还是有很 ...

  6. SpringBoot热部署配置(基于Maven)

    热部署的意思是只要类中的代码被修改了,就能实时生效,而不用重启项目.spring-boot-devtools 是一个为开发者服务的一个模块,其中最重要的功能就是自动应用代码更改到最新的App上面去.原 ...

  7. Intellij IDEA 热部署处理

     1. 首先参考IDEA热部署同行经验分享:  Intellij IDEA 4种配置热部署的方法 2. IDEA 热部署实战: springboot项目: 不要引入热部署工具包spring-boot- ...

  8. 记录Tomcat7.x热部署配置过程

    我自己的开发版本是tomcat7.0.43+myeclipse14 原版在:http://blog.csdn.NET/chen_zw/article/details/8867779 热部署是指在你对项 ...

  9. apache-maven-3.3.9集成apache-tomcat-7.0.72实现热部署配置细节

    1.开发环境.Maven.Tomcat安装不作描述,搜索引擎很多文章可供参考. 2.Tomcat配置文件修改 1)Tomcat管理权限配置 1.1)在tomcat安装目录下找到tomcat-users ...

随机推荐

  1. C++ part4

    红黑树 references: 红黑树详细分析,看了都说好 关于红黑树(R-B tree)原理,看这篇如何 性质: 1.节点是红色或黑色 2.根节点是黑色 3.叶子节点(叶子节点均为NULL)都是黑色 ...

  2. 2019牛客多校第一场I Points Division(DP)题解

    题意: n个点,分成两组A,B,如果点i在A中,那么贡献值\(a_i\),反之为\(b_i\). 现要求任意\(i \in A,j \in B\)不存在 \(x_i >= x_j\) 且 \(y ...

  3. 图片转tfrecords

    import numpy as np import tensorflow as tf import time import os import cv2 from sklearn.utils impor ...

  4. SVG in Action

    SVG in Action HTML5 semantic HTML5 Semantic Elements / HTML5 Semantic Tags figure object <figure& ...

  5. BB link

    1 1 1 BB link: 1 1 demo: code: result: 1 1 1 1 1 1 1

  6. I ❤️ W3C : Secure Contexts

    I ️ W3C : Secure Contexts Secure Contexts W3C Candidate Recommendation, 15 September 2016 https://ww ...

  7. PHP & LAMP & WAMP

    PHP & LAMP & WAMP https://github.com/xgqfrms/DataStructure/issues/7#issuecomment-430538438 h ...

  8. node.js 中间件

    node.js 中间件 node.js middleware Express middleware body-parser cookie-parser cookie-session cors csur ...

  9. Node.js Learning Paths

    Node.js Learning Paths Node.js in Action Node.js Expert situations / scenario Restful API OAuth 2.0 ...

  10. scrollTo & js auto scroll & scrollX & scrollY

    scrollTo & js auto scroll & scrollX & scrollY scrollX & scrollY 获取 scroll top height ...