huaqimeng opened a new issue, #13922:
URL: https://github.com/apache/dubbo/issues/13922

   ### Pre-check
   
   - [X] I am sure that all the content I provide is in English.
   
   
   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache Dubbo Component
   
   Java SDK (apache/dubbo)
   
   ### Dubbo Version
   
   
           <dependency>
               <groupId>org.apache.dubbo</groupId>
               <artifactId>dubbo-spring-boot-starter</artifactId>
               <version>3.2.10</version>
           </dependency>
   
           JDK:21
   
   ### Steps to reproduce this issue
   
   在A服务中返回一个Map<Integer, 
UserLevelVO>结果,A服务是正常的,但是B服务拿到的是只有第一个参数不为null,其他后面的参数都为null。有个奇怪的现象是如果我在实体类里面加一个private
 List<UserLevelVO> userLevelList; 
那么B服务可以拿到正常的数据。现在我把dubbo的序列化配置成下面这个,不用加userLevelList参数也能拿到正常的参数。请问一下,这个问题是什么原因导致的,为什么只有第一个参数不会为null,后面的都会为null?
    provider:
       prefer-serialization: hessian2,fastjson2
   
   @Getter
   @Setter
   @SuperBuilder
   @NoArgsConstructor
   @Accessors(chain = true)
   public class GetUserLevelRsp extends DataMapVO<Integer, UserLevelVO> {
   
       @Serial
       private static final long serialVersionUID = 8751433520190224903L;
   
       // private List<UserLevelVO> userLevelList;
   
   }
   
   @Getter
   @Setter
   @SuperBuilder
   @NoArgsConstructor
   @AllArgsConstructor
   @Accessors(chain = true)
   public class DataMapVO<I, T> implements AbstractBasicVO {
   
       @Serial
       private static final long serialVersionUID = 7798404966291352969L;
   
       @JsonInclude(JsonInclude.Include.NON_NULL)
       private Map<I, T> voMap = new HashMap<>();
   
       /**
        * 根据Id获取视图
        */
       @JsonIgnore
       public T getVO(I infoId) {
           return voMap.get(infoId);
       }
   
       /**
        * 获取用户
        */
       @JsonIgnore
       public T getVO() {
           return voMap.values().stream().findFirst().orElse(null);
       }
   
       /**
        * 获取视图列表
        */
       @JsonIgnore
       public List<T> getVOList() {
           return new ArrayList<>(voMap.values());
       }
   
       @JsonIgnore
       public <R extends DataMapVO> R setVOMap(Map<I, T> voMap) {
           this.voMap = voMap;
           return (R)this;
       }
   }
   
       @Override
       @ServiceApi
       public GetUserLevelRsp getUserLevel(GetUserLevelReq req) {
           List<Integer> idList = req.getIdList();
           if (idList.isEmpty()) {
               return new GetUserLevelRsp();
           }
           GetUserLevelRsp levelRsp = new GetUserLevelRsp();
           Map<Integer, UserLevelVO> map = new HashMap<>();
           idList.stream().distinct().forEach(id -> {
               map.put(id, 
UserLevelVO.builder().glamourLevel(glamourLevel).richLevel(richLevel).build());
           });
           levelRsp.setVOMap(map);
           // 
levelRsp.setUserLevelList(map.values().stream().collect(Collectors.toList()));
           log.error("levelRsp = {}", ToolFastJson.objectToJson(levelRsp));
           return levelRsp;
       }
   
   
![image](https://github.com/apache/dubbo/assets/52306283/cdec2869-6865-4588-bf1f-cbab65cdf5d0)
   
![image](https://github.com/apache/dubbo/assets/52306283/e50e9f70-e200-41f1-8833-13f372ab5898)
   
   
   ### What you expected to happen
   
   是不是dubbo的序列化哪里有问题?
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [X] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to