zoukankan      html  css  js  c++  java
  • fegin client使用http url合约时报: [Request processing failed; nested exception is feign.FeignException: status 400 reading

    首先看feign client代码:

      

    @FeignClient(name = "SPRING-CLOUD-WEB-PROVIDER-GROUP2", url = "http://localhost:8761/")
    public interface SongFeignClientWithUrl {
        /*@GetMapping("/call/{id}")
        public Object getSongInfo(@PathVariable("id") int id);*/
    
        @RequestMapping(value = "/eureka/apps/{serviceName}", method = RequestMethod.GET)
        public Object findServiceInfoFromEurekaByServiceName(@RequestParam(value = "serviceName") String serviceName);
    }

    上面实际是从eureka中查询service的节点服务信息

    如下是controller代码:

      

    @GetMapping("/{serviceName}")
        public Object findServiceInfoFromEurekaByServiceName(/*@PathVariable("serviceName")*/ String serviceName) { return songFeignClientWithUrl.findServiceInfoFromEurekaByServiceName(serviceName); }

    问题就出在Controller入参String serviceName,注解被注释或者没有加@PathVariable注解,导致入参取不到值,feign client拿到的也是null,报的这个错。。。

    当然,如果返回数据太大也会报400

  • 相关阅读:
    Visual Studio 2008 完全卸载
    设置 Visual Studio 文件版权信息
    安装 Visual Studio 插件 Visual Assist
    下载 / 安装 Visual Studio
    Python help 函数
    Python next 函数
    Python oct 函数
    Python min 函数
    Python reload 函数
    numpy中matrix的特殊属性
  • 原文地址:https://www.cnblogs.com/dbaxyx/p/8884889.html
Copyright © 2011-2022 走看看