Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

隐式参数传递支持map数据结构 #149

Open
lsc1943 opened this issue Jul 30, 2021 · 1 comment
Open

隐式参数传递支持map数据结构 #149

lsc1943 opened this issue Jul 30, 2021 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@lsc1943
Copy link

lsc1943 commented Jul 30, 2021

我们这边使服务端用dubbo会在RpcContext.getContext().setAttachment(key, value)里的value中使用一个map而不是字符串, 现在的方式直接序列化过去是string导致服务端无法解析。
我这边稍微修改了下让它沿用ClassUtils.parseParameter兼容其他数据格式的反序列化。
List attachmentArgs = Constants.getAttachmentArgs(this);
if (attachmentArgs != null && !attachmentArgs.isEmpty()) {
List attachmentParameterTypeList = new ArrayList();
List attachmentParameterValueList = new ArrayList();
for(MethodArgument attachmentArg : attachmentArgs) {
ClassUtils.parseParameter(attachmentParameterTypeList, attachmentParameterValueList, attachmentArg);
}
IntStream.range(0, attachmentParameterValueList.size()).forEach(i -> RpcContext.getContext().setAttachment(attachmentParameterTypeList.get(i), attachmentParameterValueList.get(i)));
}

@ningyu1
Copy link
Collaborator

ningyu1 commented Aug 5, 2021

@lsc1943 可以的

@ningyu1 ningyu1 added the help wanted Extra attention is needed label Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants