hprose / hprose-java

Hprose is a cross-language RPC. This project is Hprose 2.0 for Java
MIT License
550 stars 187 forks source link

查询单个对象的时候 可以 但是 查询 对象集合的时候 就不行了 List<A> #46

Closed allenwtl closed 5 years ago

allenwtl commented 5 years ago

Originally posted by @andot in https://github.com/hprose/hprose-java/issues/43#issuecomment-389490414

andot commented 5 years ago

unserialize 方法有个 Type 类型的参数,对于 List 这种泛型,你需要指定具体的泛型类型才可以按照你指定的类型反序列化,不带类型参数的话,是按照默认的类型映射来反序列化的。

andot commented 5 years ago

如果你不是直接使用unserialize方法,那你应该是在反序列化的一段没有注册该类型。请参见:https://github.com/hprose/hprose-java/wiki/Hprose-%E5%BA%8F%E5%88%97%E5%8C%96#register-%E6%96%B9%E6%B3%95

allenwtl commented 5 years ago

我是使用 motan 框架 他们框架中使用 hprose 进行序列化 List 难道不是自动进行 注册和检测 吗

allenwtl commented 5 years ago

是返回的结果 是单个对象的时候 就可以 但是返回的结果是List 集合的时候 就不行了

allenwtl commented 5 years ago

明白了