调用错误如下:
Caused by: java.lang.IllegalStateException: Method has too many Body parameters: public abstract com.qolome.utils.web.HttpResult com.fuli.salary.feign.accounts(com.fuli.salary.feign.accounts.model.OpenAccountParam,org.springframework.validation.BindingResult)
at feign.Util.checkState(Util.java:130) ~[feign-core-10.2.3.jar:na]
at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:117) ~[feign-core-10.2.3.jar:na]
at org.springframework.cloud.openfeign.support.SpringMvcContract.parseAndValidateMetadata(SpringMvcContract.java:188) ~[spring-cloud-openfeign-core-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at feign.Contract$BaseContract.parseAndValidatateMetadata(Contract.java:66) ~[feign-core-10.2.3.jar:na]
at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:154) ~[feign-core-10.2.3.jar:na]
at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:52) ~[feign-core-10.2.3.jar:na]
at feign.Feign$Builder.target(Feign.java:251) ~[feign-core-10.2.3.jar:na]
at org.springframework.cloud.openfeign.HystrixTargeter.target(HystrixTargeter.java:36) ~[spring-cloud-openfeign-core-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.cloud.openfeign.FeignClientFactoryBean.loadBalance(FeignClientFactoryBean.java:238) ~[spring-cloud-openfeign-core-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.cloud.openfeign.FeignClientFactoryBean.getTarget(FeignClientFactoryBean.java:267) ~[spring-cloud-openfeign-core-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.cloud.openfeign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:247) ~[spring-cloud-openfeign-core-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:171) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
... 43 common frames omitted
其中方法中的 @RequestBody 可以不写,但不要写成 @RequestParam("creditCode") 形式
因为外部系统的定义方法如下:
@ApiOperation(value = "根据企业ID获取已入网的企业信息", notes = "根据企业ID获取已入网且有效的企业信息")
@PostMapping(value = "/companyList")
public Result<List<CompanyInfoVO>> getCompanyByCorpId(@RequestBody @Validated(VdGroupSequence.class) CorpInfoParam param, BindingResult result){
log.info("【APP端调用接口>获取已入网的企业信息】:参数 => {}", param);
}
这里需要保持一致