springCloud:"exception":"org.springframework.web.bind.MissingServletRequestParameterException","mess

springCloud使用feign消费服务的时候.当使用带参的接口方法时,没有添加@RequestParam注释,导致错误:

正确写法是:

@FeignClient(value="gaoyang")
public interface Demo {
	@RequestMapping("/hi")
	String hi(@RequestParam(value="name") String name);
}

错误写法:

@FeignClient(value="gaoyang")
public interface Demo {
	@RequestMapping("/hi")
	String hi( String name);
}


输出错误信息:

feign.FeignException: status 400 reading Demo#hi(String); content:
{"timestamp":1518589058394,"status":400,"error":"Bad Request","exception":"org.springframework.web.bind.MissingServletRequestParameterException","message":"Required String parameter 'name' is not present","path":"/hi"}



你可能感兴趣的:(springCloud:"exception":"org.springframework.web.bind.MissingServletRequestParameterException","mess)