![](/img/trans.png)
[英]Java Spring: proxyMode = ScopedProxyMode.TARGET_CLASS how is it possible that the same object has different attributes?
[英]How to deserialize an object persisted class has less attributes in class and new class has extra attributes
Persisted class has
Class A { boolean x; boolean y; }
New Class
Class A { boolean x; boolean y; boolean z; }
在类中有“serialVersionUID”。 如果你没有在类中设置这个变量,Java 会自动生成它:
您需要在已经序列化的对象中知道这个变量。 在您可以在新类中设置此值之后:
class A {
private static final long serialVersionUID = [value_from_old_class];
//...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.