feign报错java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0

原创 2020-03-26 10:29 阅读(327)次

修改了一下feign接口,原本可以的接口突然报错:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cn.com.datu.thirdpartapi.feign.OpodMetaOfProfileFeign': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0

看了下错误:RequestParam.value() was empty on parameter 0

说是RequestParam参数的value没有设置,feign接口代码如下:

    @RequestMapping(value = "/dossier/meta", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    ApiResponse<MetaProfileDTO> getMetaProfile(@RequestParam String id);


于是在@RequestParam加上value定义,如下:

    @RequestMapping(value = "/dossier/meta", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    ApiResponse<MetaProfileDTO> getMetaProfile(@RequestParam(value = "id") String id);
服务就正常启动了