
将表单编码器用于伪装: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)}欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)