@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);
}
报错:
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)
解决方法:
当使用Feign时,如果发送的是get请求,那么需要在请求参数前加上@RequestParam注解修饰,Controller里面可以不加该注解修饰。
@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);
}