不是 REST 客户端接口:接口 MyClient。在 class 或 .... [Quarkus] 的任何方法中未找到 @Path 注释

Not a REST client interface: interface MyClient. No @Path annotation found on the class or any methods of .... [Quarkus]

我有一个消耗 api 的项目,并且正在努力将 Rest Client 注入到我的服务中。
(请注意,我主要是在做我在另一个有效的实例中所做的事情,但是我无法确定这里有什么问题导致这个失败)

我的客户端界面:


@org.eclipse.microprofile.rest.client.inject.RegisterRestClient(
  configKey = "my.feature-service.baseUrl"
)
@org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders(MyCustomHeadersFactory.class)
@javax.ws.rs.Consumes({"application/vnd.cust.my-service-config+json;version=1.0;charset=UTF-8"})
@javax.ws.rs.Produces({"application/vnd.cust.my-service-config+json;version=1.0;charset=UTF-8"})
public interface FeatureServiceClient {
  @javax.ws.rs.GET
  @javax.ws.rs.Path("/v1/my/feature")
  Uni<List<MyDto>> getPossibleFeatures();
  //and several other methods
}

在我的消费方面,我有:


@javax.enterprise.context.ApplicationScoped
public class MyService {

  @org.eclipse.microprofile.rest.client.inject.RestClient
  FeatureServiceClient serviceClient;

}

但是当它尝试初始化时我得到:


Caused by: java.lang.IllegalArgumentException: Not a REST client interface: interface my.feature.FeatureServiceClient. No @Path annotation found on the class or any methods of the interface and no HTTP method annotations (@POST, @PUT, @GET, @HEAD, @DELETE, etc) found on any of the methods
    at org.jboss.resteasy.reactive.client.impl.ClientProxies.get(ClientProxies.java:26)
    at org.jboss.resteasy.reactive.client.impl.WebTargetImpl.proxy(WebTargetImpl.java:382)
    at io.quarkus.rest.client.reactive.runtime.RestClientBuilderImpl.build(RestClientBuilderImpl.java:273)
    at io.quarkus.rest.client.reactive.runtime.RestClientCDIDelegateBuilder.build(RestClientCDIDelegateBuilder.java:76)
    at io.quarkus.rest.client.reactive.runtime.RestClientCDIDelegateBuilder.createDelegate(RestClientCDIDelegateBuilder.java:57)
    at io.quarkus.rest.client.reactive.runtime.RestClientReactiveCDIWrapperBase.<init>(RestClientReactiveCDIWrapperBase.java:16)
    at my.feature.MyFeatureClient$$CDIWrapper.<init>(FeatureServiceClient$$CDIWrapper.zig:21)
    at my.feature.MyFeatureClient$$CDIWrapper_ClientProxy.<init>(MyFeatureClient$$CDIWrapper_ClientProxy.zig:28)
    at my.feature.MyFeatureClient$$CDIWrapper_Bean.proxy(FeatureServiceClient$$CDIWrapper_Bean.zig:40)
    at my.feature.MyFeatureClient$$CDIWrapper_Bean.get(FeatureServiceClient$$CDIWrapper_Bean.zig:243)
    at my.feature.MyFeatureClient$$CDIWrapper_Bean.get(FeatureServiceClient$$CDIWrapper_Bean.zig:259)
    at my.consumer.Myservice_Bean.create(MyService_Bean.zig:175)
    ... 67 more
    <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
    <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
    <quarkus.platform.version>2.3.0.CR1</quarkus.platform.version>

所以,找到了解决方案。

我将以下构建插件添加到连接我的客户端界面的模块中


  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${compiler-plugin.version}</version>
        <configuration>
          <parameters>${maven.compiler.parameters}</parameters>
          <annotationProcessorPaths>
            <path>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>${org.projectlombok.version}</version>
            </path>
          </annotationProcessorPaths>
          <!-- the parameters=true option is critical so that RESTEasy works fine -->
          <parameters>true</parameters>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jboss.jandex</groupId>
        <artifactId>jandex-maven-plugin</artifactId>
        <version>1.1.0</version>
        <executions>
          <execution>
            <id>make-index</id>
            <goals>
              <goal>jandex</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

不完全确定是哪一个导致错误真正得到解决,我不希望任何缺失的错误出现这样的错误。