Why did some APIs implement the Serializable interface but did not declare a serialVersionUID?

I was confused when I looked at the source code org.springframework.jdbc.datasource.DataSourceTransactionManager, why does it implement Serializable, but was not in it serialVersionUID?

[ serializable]

+4
source share
1 answer

It is recommended to declare it, but you can omit it, the default mechanism will take care of this.

serializable serialVersionUID, serialVersionUID , Java (TM). , , serialVersionUID, serialVersionUID , , , InvalidClassExceptions . , serialVersionUID java-, serialVersionUID.

+3
source

Source: https://habr.com/ru/post/1680797/


All Articles