@Configuration
public class Config {
//将Integer 映射未枚举处理器
@MappedTypes({MState.class})
@MappedJdbcTypes(value ={JdbcType.TINYINT, JdbcType.INTEGER})
public static class MStateTypeHandler extends EnumOrdinalTypeHandler<MState> {
public MStateTypeHandler() {
super(MState.class);
}
}
//JSON处理器
@MappedTypes({EventHandlingContext.class})
@MappedJdbcTypes(value ={JdbcType.VARCHAR, JdbcType.UNDEFINED})
public static class EventHandlingContextHandler extends FastjsonTypeHandler {
public EventHandlingContextHandler() {
super((Class)EventHandlingContext.class);
}
}
//将处理器注册未bean
@Bean
public MStateTypeHandler getTypeHandlerForMState() {
return new MStateTypeHandler();
}
@Bean
public FastjsonTypeHandler getJsonTypeHandler() {
return new EventHandlingContextHandler();
}
}
Comments are closed.