Create configuration file

You can easily create Mybatis configuration file by following New → Mybatis → New Configuration File:

new configuration file

Attributes

The plugin will provide attributes auto-completion and inspections based on the configuration file DTD and Mybatis official documents, auto-completion is context-aware and available for all attributes.

attributes auto completion

attributes inspection

Property

Properties are externalizable, substitutable properties that can be configured in a typical Java Properties file instance, or passed in through sub-elements of the properties element. The properties can then be used throughout the configuration files to substitute values that need to be dynamically configured.

The plugin inserts } automatically when you type ${ and provides auto-completion and inspections based on your configured properties tag:

property completion

The default value in placeholder is supported as well. The plugin even takes care of org.apache.ibatis.parsing.PropertyParser.default-value-separator property if it's present:

default property value

You can use find usage to see where a property name is used:

find-property-usage.gif

Navigation and rename refactoring work as well:

rename-property-name.gif

All these stuff mentioned above work well in Spring XML configuration and Spring Boot properties:

spring property

Note: You need to set org.apache.ibatis.parsing.PropertyParser.enable-default-value property to true to enable default value in placeholder.

Environments

It's very easy to edit environment elements, you get auto-completion, navigation, refactoring, etc.

environment element

Type alias

A type alias is simply a shorter name for a Java type. It's only relevant to the XML configuration and simply exists to reduce redundant typing of fully qualified classnames. You can find more details about type alias here.

The alias and alias package elements in the configuration file will be used to provide common IntelliJ stuff (e.g., auto-completion, navigation, refactoring, etc.). It's available in all places where alias can be used (e.g., mapper XML, annotation, etc.).

alias.gif

Note: Type alias is case insensitive.

Element inspections

There are many useful inspections and quick fixes available there while you're editing:

quick-fix.gif

Codes Magic © 2013-2018 · Terms