java - Spring boot mybatis custom converter problem
ringa_lee
ringa_lee 2017-06-14 10:54:51
0
1
1341

When spring boot is integrated with mybatis, the custom typehandler (converter) is not called
First, the table structure

Entity

Enumeration type

Custom handler

mybatis.type-handlers-package has been configured

Here comes a great assist

ringa_lee
ringa_lee

ringa_lee

reply all(1)
洪涛

Mybatis will use EnumTypeHandler to handle Enum type by default, see the following code:

if (handler == null && type != null && type instanceof Class &&         
       Enum.class.isAssignableFrom((Class<?>) type)) {
    handler = new EnumTypeHandler((Class<?>) type);
}

If you want to use your own typeHandler, you need to register your own typeHandler first, and then set the typeHandler when setting parameters and getting results.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template