@FeignClient(value = "poi-portrait-service",path = "/poi") public interface PoiClassifyMonthFeign { @GetMapping(value = "/selectPoiClassify") public Result<List<PoiClassifyMonth>> selectPoiClassify(String startDate, String endDate, String cityId, String level, String category); }
報錯:java
Caused by: java.lang.IllegalStateException: Method has too many Body parameters: public abstract com.test.map_bi.bean.common.Result com.test.map_bi.service.PoiClassifyMonthFeign.selectPoiClassify(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
解決方法:app
當使用Feign時,若是發送的是get請求,那麼須要在請求參數前加上@RequestParam註解修飾,Controller裏面能夠不加該註解修飾。ui
@FeignClient(value = "poi-portrait-service",path = "/poi") public interface PoiClassifyMonthFeign { @GetMapping(value = "/selectPoiClassify") public Result<List<PoiClassifyMonth>> selectPoiClassify(@RequestParam(name = "startDate",required = true) String startDate, @RequestParam(name = "endDate",required = true) String endDate, @RequestParam(name = "cityId",required = true) String cityId, @RequestParam(name = "level",required = true) String level, @RequestParam(name = "category",required = false) String category); }