当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
2022.8.8 Exam questions for photographer Lao Ma (photographer)
State compression small experience
微生物是如何影响身体健康的
官宣出自己的博客啦
深度学习(五) CNN卷积神经网络
流星加速器木马分析与处置方案
宝塔服务器PHP+mysql网页URL跳转问题
2022.8.9考试独特的投标拍卖--800题解
Data Governance (5): Metadata Management
liunx PS1 settings
Pagoda server PHP+mysql web page URL jump problem
The 25th day of the special assault version of the sword offer
T5:Text-toText Transfer Transformer
剑指offer专项突击版第25天
web crawler error
数组(一)
Redis - String|Hash|List|Set|Zset数据类型的基本操作和使用场景
How Microbes Affect Physical Health
C# 单例模式
如何编写一份优质的测试用例?