1.在使用spring cloud feign调用提供者的时候报错
feign.FeignException: status 404 reading TestService#addRedis(String)
2018-04-17 14:53:43.427 ERROR 1036 --- [nio-8763-exec-7] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/activity-consumer-service] threw exception [Request processing failed; nested exception is com.netflix.hystrix.exception.HystrixRuntimeException: TestService#addRedis(String) failed and no fallback available.] with root cause
feign.FeignException: status 404 reading TestService#addRedis(String)
2.调用提供者代码
@FeignClient(value = "activity-provider-service")
public interface TestService {
@RequestMapping(value = "/user/add/{id}", method = RequestMethod.GET)
public String addRedis(@RequestParam("id") String id);
}
@RestController
public class TestController {
@Autowired
private TestService testService;
@GetMapping("/feign/{id}")
public String findByIdFeign(@PathVariable String id) {
return testService.addRedis(id);
}
}
3.错误截图
在网上找了什么解决方法,都没有效果,有遇到同样问题的人吗?你是怎么解决的?