Spring Cloud Feign接口调用出现400错误

Feign接口调用出现400错误可能有很多种情况,我就来讲一下我的碰到400错误。

400报错原因:

Feign消费者调用被消费者接口时传入参数为null,导致400错误。

报错未处理之前:

//Feign消费者
@RequestMapping("/test")
public void test(String testStr){
}

报错处理之后:

//Feign消费者
@RequestMapping("/test")
public void test(String testStr){
    testStr=testStr==null?"":testStr;
}
发布了34 篇原创文章 · 获赞 1 · 访问量 1946

猜你喜欢

转载自blog.csdn.net/qq_38974638/article/details/104773650
今日推荐