当前位置:网站首页>The IDEA to automatically generate the serialVersionUID
The IDEA to automatically generate the serialVersionUID
2022-08-10 03:32:00 【struggling newbie】
Serialization and Deserialization
Java is an object-oriented language. To interact with other languages (such as HTTP communication with front-end js), it is necessary to convert objects into a common format such as json (the front-end obviously does not recognize Java objects), from objects to json charactersThe conversion of strings is the process of serialization, and conversely, the conversion from json strings to Java objects is the process of deserialization.
What is serialVersionUID
The deserialization process requires generating a Java object from a json string.
There will be a problem at this time. It is necessary to verify whether the input json string is serialized from the current Request class. SerialVersionUID is used for this.When the serialVersionUID during serialization is inconsistent with the serialVersionUID during deserialization, an InvalidCalssException will be thrown.
The specific serialization process is as follows: During the serialization operation, the system will write the serialVersionUID of the current class into the serialized file. When deserializing, the system will detect the serialVersionUID in the file to determine whether it matches the serialization.The serialVersionUID of the current class is consistent. If it is consistent, it means that the version of the serialized class is the same as the current class version, and the deserialization can be successful, otherwise it will fail.
How to generate
First we will implement the interface, so how to automatically generate serialVersionUID.
Set the way to automatically generate serialVersionUID as shown below
After checking as shown in the picture, select the class name, and then press alt+enter to display the options shown below
Once selected, it will generate
边栏推荐
猜你喜欢

【二叉树-简单】112. 路径总和

微生物是如何影响身体健康的

通关剑指 Offer——剑指 Offer II 012. 左右两边子数组的和相等

OpenCV图像处理学习二,图像掩膜处理

Introduction and application of quantitative trading strategies

实例047:函数交换变量

Anchor_generators.py analysis of MMDetection framework

别再用 offset 和 limit 分页了,性能太差!

OpenCV图像处理学习一,加载显示修改保存图像相关函数

MySQL: Introduction to Logging System | Error Log | Query Log | Binary Log: Bin-log Data Recovery Practice | Slow Log Query
随机推荐
2022.8.8 Exam area link (district) questions
Algorithm and voice dialogue direction interview question bank
what is a microcontroller or mcu
openpose脚部标注问题梳理
SQLserver加个判断
C# 单例模式
Redis - String|Hash|List|Set|Zset数据类型的基本操作和使用场景
【二叉树-中等】1261. 在受污染的二叉树中查找元素
T5: Text-to-Text Transfer Transformer
What makes training multi-modal classification networks hard?
论旅行之收获
2022杭电多校联赛第七场 题解
web crawler error
Open3D 网格均匀采样
[Kali Security Penetration Testing Practice Course] Chapter 8 Web Penetration
中级xss绕过【xss Game】
ECCV 2022 Oral | CCPL: 一种通用的关联性保留损失函数实现通用风格迁移
数据挖掘和数据仓库之间的区别
【二叉树-中等】687. 最长同值路径
16. 最接近的三数之和