Java 【dubbo rpc改feign调用】解决调用服务提供方无法传递完整参数问题

dubbo rpc改feign调用,feign调用接口异常统一处理

【框架改造问题点记录,dubbo改为spring cloud alibaba】
【第二篇】feign接口异常解决
【描述】多参数情况下,调用服务提供方无法传递完整参数、改@SpringQueryMap原因是会将实体自动拆分为拼接参数。目前只遇到多参数:实体和单参数情况,持续更新...

服务调用方

示例三处有问题代码:

java 复制代码
@RequestMapping(value = "api相对路径", method = RequestMethod.POST)
ResultEntity functionName(@RequestBody Account account, @RequestParam("tenant") String tenant);
java 复制代码
@RequestMapping(value = "api相对路径", method = RequestMethod.POST)
ResultEntity functionName(Account account, @RequestParam("tenant") String tenant);
java 复制代码
@RequestMapping(value = "api相对路径", method = RequestMethod.GET)
ResultEntity functionName(Account account, @RequestParam("tenant") String tenant);

正确代码:

java 复制代码
@RequestMapping(value = "api相对路径", method = RequestMethod.POST)
ResultEntity functionName(@SpringQueryMap Account account, @RequestParam("tenant") String tenant);

正确代码2:

java 复制代码
@RequestMapping(value = "api相对路径", method = RequestMethod.POST)
ResultEntity functionName(@RequestBody Account account, @RequestParam("tenant") String tenant);

服务提供方

注意请求方式保持一致即可:

java 复制代码
@PostMapping("/api方法名")
ResultEntity functionName(Account account, String tenantId);

正确代码2:

java 复制代码
@PostMapping("/api方法名")
ResultEntity functionName(@RequestBody Account account, String tenantId);
相关推荐
BD_Marathon2 小时前
【Flink】部署模式
java·数据库·flink
鼠鼠我捏,要死了捏5 小时前
深入解析Java NIO多路复用原理与性能优化实践指南
java·性能优化·nio
ningqw5 小时前
SpringBoot 常用跨域处理方案
java·后端·springboot
superlls5 小时前
(Redis)主从哨兵模式与集群模式
java·开发语言·redis
叫我阿柒啊7 小时前
Java全栈工程师面试实战:从基础到微服务的深度解析
java·redis·微服务·node.js·vue3·全栈开发·电商平台
hqxstudying8 小时前
mybatis过渡到mybatis-plus过程中需要注意的地方
java·tomcat·mybatis
lichkingyang8 小时前
最近遇到的几个JVM问题
java·jvm·算法
ZeroKoop8 小时前
多线程文件下载 - 数组切分,截取文件名称
java
Monly218 小时前
IDEA:控制台中文乱码
java·ide·intellij-idea
叫我阿柒啊9 小时前
从全栈开发到微服务架构:一次真实的Java面试实录
java·redis·ci/cd·微服务·vue3·springboot·jwt