最近采用了雪花算法作为另外一个IOT项目的分布式主键,但是好像有点毛病。
我期望的数据结果:1360538800409284609
API返回给前端的数据结果:1360538800409284600
很明显的精度丢失,最简答的解决办法,全局配置API返回Long to String
/** * Long to String for front-end */ @Configuration public class LongToStringJsonConfig extends WebMvcConfigurationSupport { public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(); ObjectMapper objectMapper = new ObjectMapper(); SimpleModule simpleModule = new SimpleModule(); simpleModule.addSerializer(Long.class, ToStringSerializer.instance); simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); objectMapper.registerModule(simpleModule); jackson2HttpMessageConverter.setObjectMapper(objectMapper); converters.add(jackson2HttpMessageConverter); } }
轻松解决。
(我们是否应该在数据设计上真正的改变这个取值?)
相关推荐
spring boot api chm spring boot api chm spring boot api chm
Spring Boot API Project Seed 是一个基于Spring Boot & MyBatis的种子项目,用于快速构建中小型API、RESTful API项目,该种子项目已经有过多个真实项目的实践,稳定、简单、快速,使我们摆脱那些重复劳动,专注于...
Spring Boot API(Spring Boot 开发文档).CHM。 官网 Spring Boot API。 Spring Boot 开发文档
了解Spring Boot 2如何与其他Spring API,工具和框架集成 访问Spring MVC和新的Spring Web Sockets,以实现更简单的Web开发 使用微服务进行Web服务开发并与Spring Boot应用程序集成 无缝添加持久性和数据层,使您的...
spring-boot中文API文档。(spring-boot-中文参考手册.pdf)
spring-boot-helloWorld:spring-boot的helloWorld版本 spring-boot-mybaits-annotation:注解版本 spring-boot-mybaits-xml:xml配置版本 spring-boot-mybatis-mulidatasource:springboot+mybatis多数据源最简解决...
Spring Boot API 项目种子是一个基于Spring Boot & MyBatis 的种子项目,用于快速构建中小型API、RESTful API 项目,该种子项目已经有过多个真实项目的实践,稳定、简单、快速,使我们摆脱困境这些劳动,专注于业务...
小demo spring boot +mybatis 开发微信公众号, jar包自己用maven 引入 API 接口 搞笑段子,新闻头条 ,部分没有写完以后再补充
简介Spring Boot API Project Seed 是一个基于Spring Boot & MyBatis的种子项目,用于快速构建中小型API、RESTful API项目,该种子项目已经有过多个真实项目的实践,稳定、简单、快速,使我们摆脱那些重复劳动,专注...
赠送原API文档:spring-boot-2.5.5-javadoc.jar;赠送源代码:spring-boot-2.5.5-sources.jar;赠送Maven依赖信息文件:spring-boot-2.5.5.pom;包含翻译后的API文档:spring-boot-2.5.5-javadoc-API文档-中文(简体)...
spring boot 及java1.8api中文文档
基于spring boot餐厅管理系统源码 基于spring boot餐厅管理系统源码 基于spring boot餐厅管理系统源码 基于spring boot餐厅管理系统源码 基于spring boot餐厅管理系统源码 基于spring boot餐厅管理系统源码 ...
赠送原API文档:spring-boot-2.0.6.RELEASE-javadoc.jar; 赠送源代码:spring-boot-2.0.6.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-boot-2.0.6.RELEASE.pom; 包含翻译后的API文档:spring-boot-2.0.6...
基于 Spring Cloud Hoxton 、Spring Boot 2.2、 OAuth2 的RBAC权限管理系统 基于数据驱动视图的理念封装 Ant Design Vue,即使没有 vue 的使用经验也能快速上手 提供 lambda 、stream api 、webflux 的生产实践 ...
Spring Boot视频教程大合集,完美帮助你学习Spring Boot,内部有3套Spring Boot学习视频教程,另附一篇Security Oauth2.0认证授权视频教程
Licence GitHub Release 简介 Spring Boot API Project Seed
spring boot mybatis js前端展示对mysql增删改查,web页面很一般,下载者可以自行增加页面布局与样式,也给刚入门spring boot 的网友以工dome
想成为java方面的全栈工程师吗 那就抓紧看吧 绝对超值 Spring Boot从前端到后台打造企业级博客全栈实战视频
Pro Spring Boot is your authoritative hands-on practical guide for increasing your Spring Framework-based enterprise Java and cloud application productivity while decreasing development time using the...
本课程内容包括Spring简介、Spring Boot简介、安装JDK、安装Maven、第一个Spring Boot程序(使用Spring Initializr构建、Spring Boot代码讲解、安装Notepad++)、构建系统、代码、配置、三种方式运行程序、安装...