java异常之-Caused by: java.lang.IllegalStateException: Method has too many Body parameters

Error message

Abnormal : java.lang.IllegalStateException: Method has too many Body parameters
Translation : java.lang.IllegalStateException: method has too many parameters Body

Caused by: java.lang.IllegalStateException: Method has too many Body parameters: public abstract com.faw.app.parking.domain.vo.TspResultVO com.faw.app.parking.service.feign.TspBasicInfoFeign.isOwner(java.lang.Long,java.lang.String)
	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.hystrix.HystrixFeign$Builder.target(HystrixFeign.java:58)
	at org.springframework.cloud.netflix.feign.HystrixTargeter.targetWithFallbackFactory(HystrixTargeter.java:78)
	at org.springframework.cloud.netflix.feign.HystrixTargeter.target(HystrixTargeter.java:53)
	at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.loadBalance(FeignClientFactoryBean.java:145)
	at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:166)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:170)
	... 72 common frames omitted

Solution : When using Feign, if sending a get request, you need to add @RequestParam comment before the modification request parameters, Controller which can be used without modification of the comment.

@GetMapping("/basicinfo/user/isOwnerByUserIdAndVin")
TspResultVO<Boolean> isOwner(@RequestParam("userId") Long userId, @RequestParam("vin") String vin);

The Spring underlying parity bit sick, currently do not know why, but others would have to follow the rules of using other people's stuff that needs attention @RequestParam annotation must not appear to be another exception to the value value.

Caused by: java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0

This should check the bottom is so, no need to do more to explain, so be on the line.

Published 215 original articles · won praise 135 · Views 1.14 million +

Guess you like

Origin blog.csdn.net/weinichendian/article/details/104000475