老师,您好。帮我看一下这个问题
来源:13-21 微服务权限功能校验
qq_穿越时空_3
2020-12-13
//调用client 注册
CommonResponse<List> response = permissionClient.createPath(
new CreatePathRequest(pathInfos)
这段代码出问题了 没看出为啥–
Exception in thread “Thread-17” feign.codec.DecodeException: Error while extracting response for type [com.imooc.coupon.study.vo.CommonResponse<java.util.List<java.lang.Integer>>] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of com.imooc.coupon.study.vo.CommonResponse<java.util.List<java.lang.Integer>> out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of com.imooc.coupon.study.vo.CommonResponse<java.util.List<java.lang.Integer>> out of START_ARRAY token
at [Source: (PushbackInputStream); line: 1, column: 1]
1回答
-
同学你好:
你这里的 Controller 方法返回的是 List<Integer> 是不可序列化的(这是由于 SpringMVC 的序列化没有做过配置),我不建议你这样直接返回一个 List,应该是返回一个定义的 Java 对象,把 List<Integer> 作为对象的一个属性即可。
欢迎来 QQ 群随时交流、讨论,也非常感谢同学的支持!
212020-12-13
相似问题