Spring boot 在Springboot 1.5.4.RELEASE中使用Feign@HeaderMap不会发送头
我试图使用feign.HeaderMap注释在rest请求中传递HTTP头的映射,但是这些头出现在正文中 代码如下: @假装客户端(name=“accounts”,url=“localhost:8080”) 公共接口AccountClient{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
@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
中,未注释的所有参数都将在正文中序列化