当前位置:网站首页>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
边栏推荐
猜你喜欢

ArcGIS Advanced (1) - Install ArcGIS Enterprise and create an sde library

【二叉树-中等】1379. 找出克隆二叉树中的相同节点

数据在内存中的存储

小菜鸟河北联通上岗培训随笔

实例043:作用域、类的方法与变量

【Kali安全渗透测试实践教程】第7章 权限提升

Difference Between Data Mining and Data Warehousing

Will signal with different start time alignment

Deep Learning (5) CNN Convolutional Neural Network

数据治理(五):元数据管理
随机推荐
2022.8.9考试排列变换--1200题解
【图像分类】2022-ConvMixer ICLR
将信号与不同开始时间对齐
idea 删除文件空行
LeetCode每日两题01:移动零 (均1200道)方法:双指针
【二叉树-中等】2265. 统计值等于子树平均值的节点数
【图像分类】2022-ResMLP
实例048:数字比大小
Robust Real-time LiDAR-inertial Initialization(实时鲁棒的LiDAR惯性初始化)论文学习
Screen 拆分屏幕
openpose脚部标注问题梳理
2022.8.9考试平衡的余数--1000题解
【语义分割】2022-HRViT CVPR
2022.8.8 Exam Travel Summary
SQLserver加个判断
推荐几款好用的MySQL开源客户端,建议收藏
On the Harvest of Travel
[Kali Security Penetration Testing Practice Tutorial] Chapter 6 Password Attack
【红队】ATT&CK - 自启动 - 利用LSA身份验证包自启动机制
控制台中查看莫格命令的详细信息