我有一个 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)
我在互联网上寻找解决方案,并在我的 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;)假/响应;