使用feign中会报错,某参数嵌套异常

报错:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘com.chinamobile.bcsec.feign.client.leakscan.LeakScanClient’: FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: RequestParam.value() was empty on parameter 3

@FeignClient(name = “LEAKSCAN”)
public interface LeakScanClient {

/**
* 创建漏扫实例
* @param instanceForCreate
* @param userId
* @param customerId
* @return LeakScanInstanceOutput
* */
@PostMapping(value="/v2/leakScan/{serviceType}/instance")
LeakScanInstanceOutput addInstance(@Validated @ModelAttribute InstanceForCreate instanceForCreate,
@RequestParam(“userId”)String userId,
@RequestParam(“customerId”)String customerId);
}

@Validated @ModelAttribute 不可以使用,需要使用@RequestBody
并且
@RequestParam(“userId”)String userId,每一个参数都要申明value值

猜你喜欢

转载自blog.csdn.net/weixin_42844971/article/details/85776109