spring-boot-protocol
spring-boot-protocol copied to clipboard
FastJsonDataCodec不支持fastjson2.0.51
` @Override public byte[] encodeResponseData(Object data, RpcMethod<RpcServerInstance> rpcMethod) { if (data == null) { return EMPTY; }
try (SerializeWriter out = new SerializeWriter()) {//这里报错
JSONSerializer serializer = new JSONSerializer(out, serializeConfig);
serializer.write(data);
return out.toBytes(CHARSET_UTF8.name());
} catch (Exception e) {
throw new RpcEncodeException("encodeResponseData " + rpcMethod + " fastjson error " + e, e);
}
}
@Override
public byte[] encodeChunkResponseData(Object data) {
if (data == null) {
return EMPTY;
}
try (SerializeWriter out = new SerializeWriter()) {//报错
JSONSerializer serializer = new JSONSerializer(out, serializeConfig);
serializer.write(data);
return out.toBytes(CHARSET_UTF8.name());
} catch (Exception e) {
throw new RpcEncodeException("encodeChunkResponseData " + data.getClass() + " fastjson error " + e, e);
}
}
` 这里的com.alibaba.fastjson.serializer.SerializeWriter 是 The resource type SerializeWriter does not implement java.lang.AutoCloseable