我使用 spring-cloud 的 feignClient 并且当我的界面中有多个 Beans 参数时出现问题,错误显示如下:
Caused by: java.lang.IllegalStateException: Method has too many Body parameters: public abstract com.wxl.pros.test.web.common.CommonResObject com.wxl.pros.test.web.feign.OrderFeignClient.createOrder(com.wxl.pros.test.services.form.order.CreateOrderForm,com.wxl.pros.test.services.vo.User)
at feign.Util.checkState(Util.java:128)
at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:114)
at org.springframework.cloud.netflix.feign.support.SpringMvcContract.parseAndValidateMetadata(SpringMvcContract.java:133)
at feign.Contract$BaseContract.parseAndValidatateMetadata(Contract.java:64)
at feign.hystrix.HystrixDelegatingContract.parseAndValidatateMetadata(HystrixDelegatingContract.java:34)
at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:146)
at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:53)
at feign.Feign$Builder.target(Feign.java:209)
at org.springframework.cloud.netflix.feign.HystrixTargeter.target(HystrixTargeter.java:48)
at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:184)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
... 27 common frames omitted
这是我的接口方法之一:
@RequestMapping(value="/order/createOrder",method=RequestMethod.POST)
public CommonResObject createOrder(@RequestBody OrderForm orderForm,@RequestBody User user);