这里使用spring-cloud-start-feign: 1.2.2 REALEASE版本,依赖管理器版本是 Camden.SR2

出错的原因是@RequestParam的value为empty时,参数会被当作Map来处理

org.springframework.cloud.netflix.feign.annotation.RequestParamParameterProcessor
代码如下:
    @Override
public boolean processArgument(AnnotatedParameterContext context,
Annotation annotation) {
RequestParam requestParam = ANNOTATION.cast(annotation);
String name = requestParam.value();
if (emptyToNull(name) != null) {
context.setParameterName(name); MethodMetadata data = context.getMethodMetadata();
Collection<String> query = context.setTemplateParameter(name,
data.template().queries().get(name));
data.template().query(name, query);
} else {
// supports `Map` types
MethodMetadata data = context.getMethodMetadata();
data.queryMapIndex(context.getParameterIndex());
}
return true;
}

  

说明spring-cloud-feign处理@RequestParam和Spring mvc的不一样,Spring mvc在@RequestParam的value为空的时候反射得到参数的名字作为value

解决方案: 给@RequestParam加上value

spring-cloud-feign 使用@RequetParam报错QueryMap parameter must be a Map: class java.lang.String的更多相关文章

  1. spring cloud feign 调用接口报错"No message available

    There was an unexpected error (type=Internal Server Error, status=500). status 404 reading HelloServ ...

  2. jstl报错:Property 'name' not found on type java.lang.String

    <c:forEach items='${navigationMenus}' var="navigationMenu" >                         ...

  3. Error creating bean with name 'com.cloud.feign.interfaces.xxxFeignClient': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalSt.PathVariable annotation was empty on

    环境: Spring Cloud:Finchley.M8 Spring Boot:2.0.0.RELEASE 报错信息: Error creating bean with name 'com.clou ...

  4. springboot启动报错:Handler dispatch failed; nested exception is java.lang.AbstractMethodError

    最近在用springboot构建项目,控制台报错:Handler dispatch failed; nested exception is java.lang.AbstractMethodError, ...

  5. Spring Cloud和eureka启动报错 解决版本依赖关系

    导读 An attempt was made to call a method that does not exist. The attempt was made from the following ...

  6. spring-cloud-feign使用@RequetParam错误:QueryMap parameter must be a Map: int

    错误: QueryMap parameter must be a Map: int spring-cloud-feign处理@RequestParam和Spring MVC的不一样,Spring MV ...

  7. 踩坑系列《三》 java -version 报错出现Error occurred during initialization of VM java/lang/NoClassDefFoundError:

    之前导入一个项目,因为该项目Spring版本过低,只能适用于1.7版本,装了jdk1.7版本.安装配置好后,打开cmd窗口,执行 java -version 指令发现没像正常一样显示版本信息,而是报了 ...

  8. 笔记本电脑切换到无线热点无法联网问题&Spring Cloud相关工程启动报错问题

    通过禁用本地网络,和禁用另一个无线网络,以及禁用后重开,修改密码,重连的方式均失败后, 使用IE浏览器浏览提示失败,点击诊断,诊断出DNS服务器无响应异常. 突然想到通过ipconfig查看ip,网关 ...

  9. Spring Cloud 使用 FeignClient 启动报错

    我们首先来看一下报错信息 Description: Field businessFeignClient in com.ysc.service.BusinessConfigService require ...

随机推荐

  1. 逻辑回归 C++

    #include <iostream>#include <string>#include <fstream>#include <sstream>#inc ...

  2. 3.4 存储简单数据的利器——Preferences

    <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="ht ...

  3. 洛谷P2916 [USACO08NOV]为母牛欢呼(最小生成树)

    P2916 [USACO08NOV]为母牛欢呼Cheering up the C… 题目描述 Farmer John has grown so lazy that he no longer wants ...

  4. JavaScript学习二

    2019-05-30 15:08:24 加油,这几天在赶高数,都…… <!DOCTYPE html> <html> <head> <script type=& ...

  5. Redis(五)-数据库

    Redis是一个字典结构的存储服务器,而实际上一个Redis实例提供了多个用来存储数据的字典,客户端可以将制定的书存储在哪个字典中,这与关系书库实例中可以i创建多个数据库类似,所以可以将其中的每个字典 ...

  6. Django:提交表单报错:RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have A

    Django:提交表单报错:RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you ...

  7. 深入理解Redis(一)——高级键管理与数据结构

    引语 这个章节主要讲解了三部分内容: 如何设计并管理Redis的键以及与其关联的数据结构: 了解并使用Redis客户端对象映射器: 介绍如何利用大O标记来评估Redis性能. 键与数据结构 键 我们先 ...

  8. 苹果html上传后图片旋转问题

    最近做移动web项目但是遇到在苹果设备上html上传图片后,图片传到后台是旋转的 旋转角度不一,因此再次 读取照片时,无法正常显示,目前已经找到解决方法,至于原因看不太懂 翻译过来也是完全按照单词翻译 ...

  9. Java实现九宫格

    import java.util.Scanner; public class Sudoku { public static void main(String[] args) { System.out. ...

  10. buf.readInt8函数详解

    offset {Number} 0 noAssert {Boolean} 默认:false 返回:{Number} 从该 Buffer 指定的 offset 位置开始读取一个有符号的8位整数值. 设置 ...