当前位置:网站首页>Redistemplate handles hash integer type problem resolution
Redistemplate handles hash integer type problem resolution
2022-06-29 06:36:00 【kgduu】
1、 problem
RedisTemplate When in the configuration , Set up hash The value of is serialized as GenericJackson2JsonRedisSerializer, When writing data, the data type is Long, But the value is small . When reading , Assign a value to Long type , Will prompt java.lang.Integer To java.lang.Long Type of mistake .
2、 Cause analysis
OjbectMapper#readValue(byte[] src, Class<T> valueType) For reading hash Of value value , It will call _findRootDeserializer To find the serializer , The call findRootValueDeserializer To find serialization .

findRootValueDeserializer Would call DeserializerCache#findValueDeserializer To determine which Deserializer, The final call is DeserializerCache#_createDeserializer2, call DeserializerFactory#createBeanDeserializer, As a matter of fact, BeanDeserializerFactory#createBeanDeserializer

about Class The type is Object Type of , Use UntypedObjectDeserializer.

During deserialization , The handling of numeric types is

If there are shaping related parameters in the context
- DeserializationFeature.USE_LONG_FOR_INTS when , use Long To represent integer data
- DeserializationFeature.USE_BIG_INTEGER_FOR_INTS, Use large integers to represent integer data
- In other cases , Use JsonParser#getNumberValue To handle integers ,ParserBase#getNumberValue It will be determined according to the length of the current integer Integer still Long

边栏推荐
- What are the uses of final?
- How to change the password after forgetting the MySQL password (the latest version of 2022 detailed tutorial nanny level)
- flutter配置国内镜像,连接真机
- 【OSPF引入直连路由时巧借静态黑洞路由做汇总】
- Chapter V online logic analyzer signaltap
- Installing modules in pycharm
- MySQL add / delete / modify query SQL statement exercise yyds dry goods inventory
- Problems with MySQL database query
- Stack -- 739 Daily temperature
- Leetcode simple problem building arrays with stack operation
猜你喜欢

Creation of Arduino uno development environment

Clickhouse data type

Pointer from beginner to advanced (2)

The generation of leetcode simple questions each character is an odd number of strings

Internet enterprises need CRM software to help

Sourcetree remote red exclamation point

The simple problem of leetcode is to divide an array into three parts equal to sum

Rearrangement string of leetcode simple question

Presto-Trial

Illustrate plug-in -- AI plug-in development -- creative plug-in -- astute graphics -- path width style function
随机推荐
Introduction to Ceres Quartet
二叉树的迭代法前序遍历的两种方法
Fault: administrator account cannot be selected for login
Fault: display Storport driver out of date in component health
Week 12 - task 2- shoulder to shoulder cadres
Hyperledger Fabric 2. X custom smart contract
Sourcetree remote red exclamation point
Fresnel diffraction with rectangular aperture based on MATLAB
QT writing map comprehensive application 58 compatible with multi browser kernel
Fault: NetBt log for id4321
Regular expressions for shell script values
Two houses with different colors and the farthest distance
Draw smooth curves - methods needed - drawing smooth curves - methods needed
Stack -- 739 Daily temperature
关于DDNS
Failure: unable to log in to "taxpayer equity platform"
Leetcode simple problem building arrays with stack operation
百度小程序自动提交搜索
Implementation of queue
'only_ full_ group_ The influence of by'sql mode on group by and its treatment