idea小手段
大约 5 分钟
title: idea小手段 category:
- 编程工具
idea小手段
@(编程工具)[idea, 小手段]
1、lombok插件安装
2、mybatis log plugin
把 mybatis 输出的sql日志还原成完整的sql语句。
3、mybatisx plugin
4、mybatis tool
同功能3
5、Alibaba Java Coding Guidelines plugin support
阿里代码规范检查插件,基于阿里java开发手册进行代码规范检查
6、mybatis xml去除黄色警告和绿色背景
1)、去掉 No data sources configure 警告
- Prefernces ⇒ Editor ⇒ Inspections ⇒ SQL ⇒ No data sources configure。
- 取消勾选,去掉这个检查,然后点击 OK 按钮即可。
2)、去掉 SQL dialect is not configured 警告
- Prefernces ⇒ Editor ⇒ Inspections ⇒ SQL ⇒ SQL dialect detection。
- 取消勾选,去掉这个检查,然后点击 OK 按钮即可。
3)、去掉“注入语言”的背景色
- Prefernces ⇒ Editor ⇒ Colors & Fonts ⇒ General ⇒ Code ⇒ Injected language fragment ⇒ Background。
- 取消勾选,然后点击 OK 按钮即可。
5、maven helper
帮助管理maven依赖,重点解决maven冲突问题
6、JavaDoc
idea安装javaDoc插件,替换.idea下面的javadoc配置,位置如下

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaDocConfiguration">
<GENERAL>
<MODE>UPDATE</MODE>
<OVERRIDDEN_METHODS>false</OVERRIDDEN_METHODS>
<SPLITTED_CLASS_NAME>true</SPLITTED_CLASS_NAME>
<LEVELS>
<LEVEL>FIELD</LEVEL>
<LEVEL>METHOD</LEVEL>
<LEVEL>TYPE</LEVEL>
</LEVELS>
<VISIBILITIES>
<VISIBILITY>PUBLIC</VISIBILITY>
<VISIBILITY>DEFAULT</VISIBILITY>
<VISIBILITY>PROTECTED</VISIBILITY>
</VISIBILITIES>
</GENERAL>
<TEMPLATES>
<CLASSES>
<CLASS>
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
<VALUE>/**\n
* The interface ${name}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
* \n
* @author Created on ${.now?string["yyyy.MM.dd"]} by lizhifeng\n
*/</VALUE>
</CLASS>
<CLASS>
<KEY>^.*(public|protected|private)*.+enum\s+\w+.*</KEY>
<VALUE>/**\n
* The enum ${name}.\n
*/</VALUE>
</CLASS>
<CLASS>
<KEY>^.*(public|protected|private)*.+class\s+\w+.*</KEY>
<VALUE>/**\n
* 功能:The type ${name}.\n
* 详细:\n
* \n
* @author Created on ${.now?string["yyyy.MM.dd"]} by lizhifeng\n
*/</VALUE>
</CLASS>
<CLASS>
<KEY>.+</KEY>
<VALUE>/**\n
* 功能:The type ${name}.\n
* 详细:\n
* \n
* @author Created on ${.now?string["yyyy.MM.dd"]} by lizhifeng\n
*/</VALUE>
</CLASS>
</CLASSES>
<CONSTRUCTORS>
<CONSTRUCTOR>
<KEY>.+</KEY>
<VALUE>/**\n
* Instantiates a new ${name}.\n
<#if element.parameterList.parameters?has_content> *\n
</#if><#list element.parameterList.parameters as parameter> * @param ${parameter.name} the ${paramNames[parameter.name]}\n
</#list><#if element.throwsList.referenceElements?has_content> *\n
</#if><#list element.throwsList.referenceElements as exception> * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
</#list> */</VALUE>
</CONSTRUCTOR>
</CONSTRUCTORS>
<METHODS>
<METHOD>
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+</KEY>
<VALUE>/**\n
* Gets ${partName}.\n
<#if element.typeParameters?has_content> * \n
</#if><#list element.typeParameters as typeParameter> * @param <${typeParameter.name}> the type parameter\n
</#list><#if element.parameterList.parameters?has_content> *\n
</#if><#list element.parameterList.parameters as parameter> * @param ${parameter.name} the ${paramNames[parameter.name]}\n
</#list><#if isNotVoid> *\n
* @return the ${partName}\n
</#if><#if element.throwsList.referenceElements?has_content> *\n
</#if><#list element.throwsList.referenceElements as exception> * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
</#list> */</VALUE>
</METHOD>
<METHOD>
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+</KEY>
<VALUE>/**\n
* Sets ${partName}.\n
<#if element.typeParameters?has_content> * \n
</#if><#list element.typeParameters as typeParameter> * @param <${typeParameter.name}> the type parameter\n
</#list><#if element.parameterList.parameters?has_content> *\n
</#if><#list element.parameterList.parameters as parameter> * @param ${parameter.name} the ${paramNames[parameter.name]}\n
</#list><#if isNotVoid> *\n
* @return the ${partName}\n
</#if><#if element.throwsList.referenceElements?has_content> *\n
</#if><#list element.throwsList.referenceElements as exception> * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
</#list> */</VALUE>
</METHOD>
<METHOD>
<KEY>^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+</KEY>
<VALUE>/**\n
* 功能:${name}.<br>\n
* 详细:\n
<#if element.typeParameters?has_content> * \n
</#if><#list element.typeParameters as typeParameter> * @param <${typeParameter.name}> the type parameter\n
</#list><#if element.parameterList.parameters?has_content> *\n
</#if><#list element.parameterList.parameters as parameter> * @param ${parameter.name} the ${paramNames[parameter.name]}\n
</#list><#if isNotVoid> *\n
* @return the ${return}\n
</#if><#if element.throwsList.referenceElements?has_content> *\n
</#if><#list element.throwsList.referenceElements as exception> * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
</#list> * \n
* @author Created on ${.now?string["yyyy.MM.dd"]} by lizhifeng\n
*/</VALUE>
</METHOD>
<METHOD>
<KEY>.+</KEY>
<VALUE>/**\n
* 功能:${name}.<br>\n
* 详细:\n
<#if element.typeParameters?has_content> * \n
</#if><#list element.typeParameters as typeParameter> * @param <${typeParameter.name}> the type parameter\n
</#list><#if element.parameterList.parameters?has_content> *\n
</#if><#list element.parameterList.parameters as parameter> * @param ${parameter.name} the ${paramNames[parameter.name]}\n
</#list><#if isNotVoid> *\n
* @return the ${return}\n
</#if><#if element.throwsList.referenceElements?has_content> *\n
</#if><#list element.throwsList.referenceElements as exception> * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
</#list> * \n
* @author Created on ${.now?string["yyyy.MM.dd"]} by lizhifeng\n
*/</VALUE>
</METHOD>
</METHODS>
<FIELDS>
<FIELD>
<KEY>^.*(public|protected|private)*.+static.*(\w\s\w)+.+</KEY>
<VALUE>/**\n
* The constant ${element.getName()}.\n
*/</VALUE>
</FIELD>
<FIELD>
<KEY>^.*(public|protected|private)*.*(\w\s\w)+.+</KEY>
<VALUE>/**\n
<#if element.parent.isInterface()> * The constant ${element.getName()}.\n
<#else> * The ${name}.\n
</#if> */</VALUE>
</FIELD>
<FIELD>
<KEY>.+</KEY>
<VALUE>/**\n
<#if element.parent.isEnum()> *${name} ${typeName}.\n
<#else> * The ${name}.\n
</#if>*/</VALUE>
</FIELD>
</FIELDS>
</TEMPLATES>
</component>
</project>
7、鼠标悬浮显示注释

8、配置database
idea集成了datagrid插件,非常好用,此外配置数据源后,mybatis xml编写sql可以达到sql代码提示的功能