如果使用Spring Boot搭建项目,可以指定property:
注意java.version
这个参数并不是maven提供的,而是Spring Boot特有的。
如果使用Spring Boot搭建项目,可以指定property:
注意java.version
这个参数并不是maven提供的,而是Spring Boot特有的。
以安装jdk1.8为例,其他版本类似。
首先找到官网下载页面
找到对应的版本,右键 复制链接地址,http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz
然后到服务器指定目录下输入命令:
使用Spring AOP过程中,可能遇到过下列奇怪问题:
由于Spring的事务底层也是用AOP实现的,因此,这些症状都可以归结为,类内部方法间调用AOP失效。
场景:
对于新版本(版本信息在请求header中)接口,使用AES算法对返回结果进行全局加密。
原始接口都是RESTful类型,使用@ResponseBody
标注,返回json数据。
考虑实现方案:
Filter
Interceptor
HttpMessageConverter
ResponseBodyAdvice
今天主要介绍resultType
和parameterType
中的alias解析。
今天要实现的功能是,检查xml中的增删改查有没有对应的DAO层方法,如果没有,则报错。
IDEA插件中是通过 Inspection 来实现这个功能。
对XML的检查,IDEA提供了一个BasicDomElementsInspection
来做基本检查,我们需要做的就是做好DOM解析工作,对关键属性添加converter
。最后注册到plugin.xml
即可。
使用Mybatis进行开发时,还有一个常用场景是从DAO层方法跳转到XML标签,或者反过来从XML标签跳转到DAO层方法。
可以使用lineMarkerProvider
来实现该功能。
Line markers help to annotate any code with icons on the gutter. These icons may provide navigation to related code.
IDEA插件开发时,可以有两种途径提供代码补全:
Reference
的getVariants()
方法,返回一个数组,类型为String
或者PsiElement
或者LookupElement
。这种方式只支持基本(basic)补全操作。CompletionContributor
,支持basic、smart和class name三种补全方式。本文主要介绍继承CompletionContributor
的方式。
IDEA插件开发(七)mybatis插件之mapper解析 一文中使用到了PropertyConverter
来为property
属性添加引用,实现鼠标点击跳转,代码补全提示等功能,其中使用了ContextPsiFieldReference
,它继承了PsiReferenceBase
,实现resolve()
方法来返回对应的引用对象。
今天主要就说说引用( PSI References ),以及如何单独注册引用。
A reference in a PSI tree is an object that represents a link from a usage of a certain element in the code to the corresponding declaration. Resolving a reference means locating the declaration to which a specific usage refers.
Resolving references gives users the ability to navigate from a PSI element usage (accessing a variable, calling a method and so on) to the declaration of that element (the variable’s definition, a method declaration and so on). This feature is needed in order to support the
Go to Declaration
action invoked by Ctrl-B and Ctrl-Click, and it is a prerequisite for implementing the Find Usages action, the Rename refactoring and code completion.
举个例子,也就是我想要实现的效果。
Dao层有个方法:
然后对应的mapper文件中的查询语句:
我现在想实现点击#{userName}
中的userName
能够跳转到Dao层方法的userName
参数,即为xml中的参数添加引用。
日常开发过程中,可能会需要抓取线上https的接口,这里介绍使用 Charles 来实现。