解决feign一直报feign.FeignException$NotFound: status 404 reading的问题

原因是由于我的项目配置了server.servlet.context-path的原因。所以,在feign的接口方法上加入context-path的路径就可以了

@FeignClient(value = "service-provider", fallback = UserClientFallback.class)
public interface UserClient {

    /**
     * 加上项目的server.servlet.context-path:provider
     * @param id
     * @return
     */
    @GetMapping("provider/user/{id}")
    public String queryUserById(@PathVariable("id") Long id);
}
发布了10 篇原创文章 · 获赞 0 · 访问量 3682

猜你喜欢

转载自blog.csdn.net/qq_26891571/article/details/104788300