![10dbefc124da8433649b04a23f54f8ae.png](https://img-blog.csdnimg.cn/img_convert/10dbefc124da8433649b04a23f54f8ae.png)
前 言
本章主要分享一些工作中常用的IDEA插件(Maven Helper、Lombok、Mybatis Log Plugin、RestfulToolkit、JRebel And XRebel)和实用工具arthas。
01
Maven Helper
作用:
能清晰的查看当项目的Maven依赖版本、依赖关系、依赖冲突等情况。
使用步骤:
①安装后,IDEA打开pom.xml,点击Dependency Analyzer
![16b27679965b35be20b52d29e5da8c32.png](https://img-blog.csdnimg.cn/img_convert/16b27679965b35be20b52d29e5da8c32.png)
②界面查看项目依赖关系
![dc9511aae07d148576415c5072034427.png](https://img-blog.csdnimg.cn/img_convert/dc9511aae07d148576415c5072034427.png)
02
Lombok
作用:
让IDEA支持Lombok框架语法。
使用步骤
①安装后IDEA即认识Lombok框架的语法。
②使用@Slf4j时就能提示出log对象,使用@Data时就能提示出对象属性Set、Get方法。
03
Mybatis Log Plugin
作用:
占位符等替换为实际参数,打印完整的sql。
使用步骤:
①首先需要开启Mybatis框架的Log,application.yml加上以下配置。
![6da2daec5ae3703617aa841b9c48c186.png](https://img-blog.csdnimg.cn/img_convert/6da2daec5ae3703617aa841b9c48c186.png)
②Tools->Mybatis Log Plugin打开Mybatis Log Plugin界面
![fd85c0d5c71567ff54c0070f84819e0c.png](https://img-blog.csdnimg.cn/img_convert/fd85c0d5c71567ff54c0070f84819e0c.png)
③后续Mybatis执行的Sql就会打印到Mybatis Log Plugin界面上
![4ee815e20b131974b8c938b47f518ef6.png](https://img-blog.csdnimg.cn/img_convert/4ee815e20b131974b8c938b47f518ef6.png)
04
RestfulToolkit
作用:
快速搜索当前项目的SpringMVC接口,快速发送请求。
使用步骤:
①点开RestServices进去操作界面。
![7d8b110c9a6d88c1dd5439f91ca3f05e.png](https://img-blog.csdnimg.cn/img_convert/7d8b110c9a6d88c1dd5439f91ca3f05e.png)
②搜索需要的接口(优势:可以用实际URL搜索,不用担心@RequestMapping拆分导致IDEA字符串搜索不到)。
![9b3d9d47bbafcdb64cca967012ba7ded.png](https://img-blog.csdnimg.cn/img_convert/9b3d9d47bbafcdb64cca967012ba7ded.png)
③发送请求(这个简单测试时比较有作用,用IDEA就直接发请求了,不用切工具)
![62246a676ba272a506efe2e384d7bf93.png](https://img-blog.csdnimg.cn/img_convert/62246a676ba272a506efe2e384d7bf93.png)
05
JRebel And XRebel
说明: JRebel和XRebel本质上是两个功能,但合并为了一个插件,所以分开说明功能。
JRebel
作用:
更强大的热部署工具,支持Spring、SpringMVC等上百个框架的热部署。
使用步骤
①安装后,选择使用功能,然后使用Rebel Run或Rebel Debug进行启动
![4ed8ba3b756b41360b4e4d62142c5165.png](https://img-blog.csdnimg.cn/img_convert/4ed8ba3b756b41360b4e4d62142c5165.png)
②Application启动的情况下,调整代码后, 点击IDEA->Run->Reload Changed Classes
![2479c6d6eeab040bf338f46f31164811.png](https://img-blog.csdnimg.cn/img_convert/2479c6d6eeab040bf338f46f31164811.png)
③外部tomcat启动的情况下,还是使用tomcat的reload,注意(JRebel对外部tomcat支持并不好,多模块项目热部署很可能失败并报错)
XRebel
作用:
查看每个接口的调用时间,对接口进行性能排查,能实时查看后端IO操作。
使用步骤:
①启动步骤同JRebel
②启动项目后,访问项目根路径+xrebel进入XRebel可视化页面
![b9faa6f4c6d26f457b05f017e24b4324.png](https://img-blog.csdnimg.cn/img_convert/b9faa6f4c6d26f457b05f017e24b4324.png)
③查看应用性能,可以通过该页面查看到后端接口的详细调用链和耗时
![eca079b129539301d24165b292321cbb.png](https://img-blog.csdnimg.cn/img_convert/eca079b129539301d24165b292321cbb.png)
④查看系统中的输入输出,比如SQL、NOSQL、Quartz、HTTP、RabbitMQ等,无法明确问题接口时,可以用该页面排查
![5695e263bee2d93704edf33ad1264b83.png](https://img-blog.csdnimg.cn/img_convert/5695e263bee2d93704edf33ad1264b83.png)
06
Arthas
作用:
排查线上性能、代码级别问题(我个人使用下的作用)
使用步骤:
①下载Arthas,默认链接为
https://alibaba.github.io/arthas/arthas-boot.jar
②在需要使用的环境下java -jar arthas-boot.jar运行arthas。
③选中需要监控的Java应用。
![98d9a6226b98734bfbc80f5903844964.png](https://img-blog.csdnimg.cn/img_convert/98d9a6226b98734bfbc80f5903844964.png)
④使用trace查看方法的调用链。
![d043bf030c03b7d4ce634ad820568ae7.png](https://img-blog.csdnimg.cn/img_convert/d043bf030c03b7d4ce634ad820568ae7.png)
⑤更多功能请查看:
https://alibaba.github.io/arthas/
![c576480258a5c486995ffc938104d8cc.png](https://img-blog.csdnimg.cn/img_convert/c576480258a5c486995ffc938104d8cc.png)