MyBatis-Plus雪花算法生成id精度丢失问题的处理
作者:互联网
/**
* @author zxy
* @description: TODO
* @date 2022/4/15
*/
@Configuration
public class JacksonConfig {
@Bean
@Primary
@ConditionalOnMissingBean(ObjectMapper.class)
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder)
{
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
// 全局配置序列化返回 JSON 处理
SimpleModule simpleModule = new SimpleModule();
//JSON Long ==> String
simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
objectMapper.registerModule(simpleModule);
return objectMapper;
}
}
标签:Long,simpleModule,class,JSON,Plus,objectMapper,MyBatis,id,ObjectMapper 来源: https://www.cnblogs.com/zxy-come-on/p/16150579.html