小编Ale*_*hko的帖子

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

语境

我有一个 spring boot (version 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>
Run Code Online (Sandbox Code Playgroud)

下面是我如何调用其他 Web 应用程序的 PATCH 方法。

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

问题

  • APP2 的 PATCH 方法被有效调用
  • 但随后 APP1 抛出以下错误:
    • feign.RetryableException:无效的 HTTP 方法:PATCH 正在执行 PATCH

我在互联网上寻找解决方案,并在我的 pom.xml 中添加了以下 snipet

<dependency>
    <groupId>com.netflix.feign</groupId> <!-- Also tried io.github.openfeign -->
    <artifactId>feign-httpclient</artifactId>
    <version>8.18.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

之后,APP2 的 PATCH 方法仍然被正确调用,但在 APP1 中我收到以下错误: java.lang.NoSuchMethodError: feign.Response.create (ILjava/lang/String;Ljava/util/Map;Lfeign/Response$Body;)假/响应;

题 …

http-patch spring-cloud-feign feign

6
推荐指数
3
解决办法
5387
查看次数

标签 统计

feign ×1

http-patch ×1

spring-cloud-feign ×1