Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 在Springboot 1.5.4.RELEASE中使用Feign@HeaderMap不会发送头_Spring Boot_Spring Cloud Feign - Fatal编程技术网

Spring boot 在Springboot 1.5.4.RELEASE中使用Feign@HeaderMap不会发送头

Spring boot 在Springboot 1.5.4.RELEASE中使用Feign@HeaderMap不会发送头,spring-boot,spring-cloud-feign,Spring Boot,Spring Cloud Feign,我试图使用feign.HeaderMap注释在rest请求中传递HTTP头的映射,但是这些头出现在正文中 代码如下: @假装客户端(name=“accounts”,url=“localhost:8080”) 公共接口AccountClient{ @RequestMapping(method = RequestMethod.GET, value = "/rest/accounts/get", produces = MediaType.APPLICATION_JSON_VALUE) Account

我试图使用feign.HeaderMap注释在rest请求中传递HTTP头的映射,但是这些头出现在正文中

代码如下:

@假装客户端(name=“accounts”,url=“localhost:8080”) 公共接口AccountClient{

@RequestMapping(method = RequestMethod.GET, value = "/rest/accounts/get", produces = MediaType.APPLICATION_JSON_VALUE)
Account findOne(@RequestParam("id") String id, @HeaderMap Map headers);

}您正在混合注释。使用
spring cloud netflix
时,您需要使用spring注释
@RequestHeader

@RequestMapping(method=RequestMethod.GET,
value=“/rest/accounts/get”,
products=MediaType.APPLICATION\u JSON\u值)
帐户findOne(@RequestParam(“id”)字符串id,@RequestHeader映射头);
默认情况下,在
Feign
中,未注释的所有参数都将在正文中序列化