spring-boot-starter-grpc 内置序列化方式说明
sofa-hessian(默认)
Github 地址:https://github.com/alipay/sofa-hessian
基本说明:Hessian 是一个性能较优且兼容性较好的二进制序列化协议。SOFA-Hessian 基于原生 Hessian v3.1.3 进行改进,目前已经蚂蚁金服内部稳定运行多年。
优点:支持复杂的 Java 对象的序列化
缺点:
- 需要序列化/反序列化的对象必须实现
java.io.Serializable
protostuff
Github 地址:https://github.com/protostuff/protostuff
基本说明:protostuff 基于 Google protobuf,但是提供了更多的功能和更简易的用法。其中,protostuff-runtime 实现了无需预编译对 Java bean进行protobuf 序列化/反序列化的能力。protostuff-runtime 的局限是序列化前需预先传入 schema,反序列化不负责对象的创建只负责复制,因而必须提供默认构造函数。此外,protostuff 还可以按照 protobuf 的配置序列化成 json/yaml/xml 等格式。
优点&