java - Spring boot mybatis custom converter problem
ringa_lee2017-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 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.
Mybatis will use EnumTypeHandler to handle Enum type by default, see the following code:
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.