美文网首页
12 feign.FeignException: status

12 feign.FeignException: status

作者: 滔滔逐浪 | 来源:发表于2019-01-21 11:44 被阅读11次

在公司的一个spring cloud 项目中,用feign client 调用服务遇到一个404问题


13423234-e1bff656f68a0671.png

原服务提供者:

  @RequestMapping(value="/index",method= RequestMethod.GET)
  public String index(String date) {
      return uv.index(date);
  }

原feign client 调用方:

@FeignClient(value = "horus-zuul-server")
public interface UvInfo{
    @RequestMapping(value = "/uv/getUvCount", method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
    String index(String date);



经过分析 发现是参数没有传过去 参数传到控制器端为null

解决方法:

参考网上思路 需要加上requestparam修饰,具体修改如下:

提供者:


  @RequestMapping(value="/index",method= RequestMethod.GET)
  public String index(@RequestParam  String date) {
      return uv.index(date);
  }


feign 调用方:


@FeignClient(value = "horus-zuul-server")
public interface UvInfo{
    @RequestMapping(value = "/uv/index", method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
    String index(@RequestParam("date") String date);


相关文章

网友评论

      本文标题:12 feign.FeignException: status

      本文链接:https://www.haomeiwen.com/subject/zztcjqtx.html