如何使用Spring Cloud Feign发布表单URL编码的数据

如何使用Spring Cloud Feign发布表单URL编码的数据,第1张

如何使用Spring Cloud Feign发布表单URL编码的数据

将表单编码器用于伪装:https :
//github.com/OpenFeign/feign-form,伪装配置如下所示:

class CoreFeignConfiguration {  @Autowired  private ObjectFactory<HttpMessageConverters> messageConverters  @Bean  @Primary  @Scope(SCOPE_PROTOTYPE)  Enprer feignFormEnprer() {      new FormEnprer(new SpringEnprer(this.messageConverters))  }}

然后,可以像这样映射客户端:

@FeignClient(name = 'client', url = 'localhost:9080', path ='/rest', configuration = CoreFeignConfiguration)interface CoreClient {    @RequestMapping(value = '/business', method = POST, consumes = MediaType.APPLICATION_FORM_URLENCODED)    @Headers('Content-Type: application/x-www-form-urlenpred')    void activate(Map<String, ?> formParams)}


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/4896352.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-12
下一篇2022-11-12

发表评论

登录后才能评论

评论列表(0条)

    保存