How to send POST request by Spring cloud Feign

后端 未结 3 461
执念已碎
执念已碎 2020-12-29 12:14

It\'s my Feign interface

@FeignClient(
        name=\"mpi\",
        url=\"${mpi.url}\",
        configuration = FeignSimpleEncoderConfig.class
)
public inte         


        
3条回答
  •  醉酒成梦
    2020-12-29 12:55

    First of all you should change your Feign interface like this:

    @FeignClient (
        configuration = FeignSimpleEncoderConfig.class
    )
    public interface MpiClient {
       @RequestMapping(method = RequestMethod.POST)
       ResponseEntity getPAReq(Map queryMap);
    }
    

    Then you should set the encoder during feign configuration:

    public class FeignSimpleEncoderConfig {
        @Bean
        public Encoder encoder() {
            return new FormEncoder();
        }
    }
    

提交回复
热议问题