Why isn't the serialVersionUID automatically generated?
问题 Why isn't the serialVersionUID automatically generated? I was running into an issue on an application server where apparently an old class was being cached. 回答1: serialversionuid is not automatically generated because it is dangerous. When serialversionuid is set, it implies that two versions of a class are compatible with respect to serialization. Imagine you have a class called Foo, and it has no serialversionuid (the default), and you serialize an instance of Foo to a file. Later, you add