spring-cloud-starter-openfeign:无效的HTTP方法:PATCH执行PATCH

问题描述 投票:1回答:1

上下文

我有一个Spring Boot(版本2.2.6.RELEASE)Web项目。

从此Web应用程序(我称为“ APP1”),我想使用另一个Web应用程序中的PATCH方法调用另一个URI(我们将其称为“ APP2”)。在我的pom.xml中,我具有以下依赖性:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>

这是我如何调用另一个Web应用程序的PATCH方法。

@FeignClient(name = "clientName", url = "base-uri")
public interface MyInterface{
   @PatchMapping(value = "/target-uri")
    void callClientMethod(Map<String, Object> args);

问题

  • APP2的PATCH方法被有效地调用
  • 但是APP1会引发以下错误:
    • feign.RetryableException:无效的HTTP方法:PATCH执行PATCH

我在互联网上寻找解决方案,并将以下代码段添加到我的pom.xml中

<dependency>
    <groupId>com.netflix.feign</groupId> <!-- Also tried io.github.openfeign -->
    <artifactId>feign-httpclient</artifactId>
    <version>8.18.0</version>
</dependency>

[之后,仍然正确调用APP2的PATCH方法,但是在APP1中,出现以下错误:java.lang.NoSuchMethodError:feign.Response.create(ILjava / lang / String; Ljava / util / Map; Lfeign / Response $ Body;)Lfeign / Response;

问题

  • 有人知道如何解决此错误吗?

感谢您的帮助!

spring-cloud-feign http-patch
1个回答
0
投票

遇到同样的问题。如果有人有任何想法请帮助。

© www.soinside.com 2019 - 2024. All rights reserved.