FeignClient调用发起请求时,请求头中Content-Type为application/x-www-form-urlencoded时,可如下设置。 1、设置请求头 @PostMapping(value = "/update",consumes =MediaType.APPLICATION_FORM_URLENCODED_VALUE) ReturnT<String> update(UserInfo userInfo); 2、注册FormEncoder @Bean Encoder formEncoder() {returnnew...
@FeignClient(name= "${flan.api.url:}", url= "${flan.api.url:}", path= "/OpenPlatform", configuration= {FeignClientConfig.class, FlanOrderProxy.Configuration.class} )publicinterfaceFlanOrderProxy { @PostMapping(value= "/pushOrderDetail", consumes =MediaType.APPLICATION_FORM_URLENCODED_VALUE)...
When I remove the Spring Cloud feign annotations (@EnableFeignClients, @FeignClient) and replace both the autowired myClient property in MyApp with private MyClient myClient = Feign.builder().encoder(new FormEncoder()).target(MyClient.class, "http://localhost:8080"); and the @RequestMapping a...
答案是按照@spencergibb建议的那样做;在FeignClient接口的@RequestMapping注释中使用consumes指令。这个Spring...
@FeignClient(name= "${flan.api.url:}", url= "${flan.api.url:}", path= "/OpenPlatform", configuration= {FeignClientConfig.class} )publicinterfaceFlanOrderProxy { @PostMapping(value= "/pushOrderDetail", consumes =MediaType.APPLICATION_FORM_URLENCODED_VALUE) ...
@FeignClient(name= "${flan.api.url:}", url= "${flan.api.url:}", path= "/OpenPlatform", configuration= {FeignClientConfig.class} )publicinterfaceFlanOrderProxy { @PostMapping(value= "/pushOrderDetail", consumes =MediaType.APPLICATION_FORM_URLENCODED_VALUE) ...