The springboot project uses @ RestController annotations. Is there a potential problem if the VO class does not implement the Serializable interface?

and input parameters use @ RequestBody annotations


Serializable is a serialization method specific to the java language and cannot be cross-language.
RestController is a serialization scheme for cross-language schemes such as json,xml or protobuf, which is naturally not related to Serializable


first clarify the role of serialization:

  • when you want to save the object state in memory to a file or database
  • when you want to spread objects over the network
For a more in-depth understanding of

, please refer to the article http://blademastercoder.githu.

.

secondly, according to the above function, your vo needs neither persistence nor network transmission, so there will be no problem, just front-end data parsing and conversion to back-end vo


I guess your concern is whether these annotations have anything to do with Serializable ,

.

my understanding is:

@ RestController ( @ ResponseBody + @ Controller ), @ RequestBody are not directly related to Serializable , and the potential problems of not implementing the interface have nothing to do with these annotations.

refer to similar questions java-web-Javabean? What's the point? -SegmentFault think

Menu