hessian接口参数,子类与父类不能有同名字段解决方法

hessian默认是使用 com.caucho.hessian.io.JavaSerializer 序列化,同名字段子类字段值被赋值两次,最终用父类null值赋给了子类同名字段,解决方法就是 指定序列化方法,用BeanSerializer序列化就解决了。

String url = "http://localhost:8080/member-app/remote/applaudManager";
HessianProxyFactory factory = new HessianProxyFactory();
factory.setOverloadEnabled(true);
factory.setDebug(true);
factory.setChunkedPost(true);
factory.setSerializerFactory(new BeanSerializerFactory());
ApplaudManager applaudManager;
try { applaudManager = (ApplaudManager) factory.create(ApplaudManager.class, url); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); }

参考文档:

  http://tianya23.blog.51cto.com/1081650/582256/

原文地址:https://www.cnblogs.com/xunux/p/4856049.html