Suzzt / dao-cloud

自研的微服务提供一站式轻量级框架(基于tcp自定义`dao`通信协议)。
Apache License 2.0
14 stars 3 forks source link

使用json序列化时,保方法参数类型不匹配错误 #6

Closed yomea closed 1 year ago

yomea commented 1 year ago

代码示例: 1、提供者:

@DaoService(serializable = Serializer.JSON)
public class DemoServiceImpl implements DemoService {

    @Override
    public ParamDTO complex(ParamDTO paramDTO) {
        paramDTO.setCharValue('s');
        paramDTO.setString("string1");
        return paramDTO;
    }
}

2、消费者

@RestController
@Slf4j
public class DemoController {

    @DaoReference(proxy = "demo", serializable = Serializer.JSON)
    private DemoService demoService;

    @RequestMapping("complex-demo")
    public String complex() {
        long start = System.currentTimeMillis();
        ParamDTO paramDTO = new ParamDTO();
        paramDTO.setString("string");
        paramDTO.setCharValue('c');
        paramDTO.setBooleanValue(true);
        paramDTO.setByteValue((byte) 1);
        paramDTO.setIntValue(1);
        paramDTO.setLongValue(1L);
        paramDTO = demoService.complex(paramDTO);
        long end = System.currentTimeMillis();
        return new Gson().toJson(paramDTO) + "====" + (end - start);
    }
}

3、错误: image

Suzzt commented 1 year ago

bug fixed