首页 > 解决方案 > Quarkus Reactive - 名称“security.jaxrs.deny-unannotated-endpoints”的多个匹配属性错误

问题描述

使用 Quarkus 我在执行时收到以下错误:

引起:java.lang.IllegalArgumentException:名称“security.jaxrs.deny-unannotated-endpoints”属性的多个匹配属性由公共布尔 io.quarkus.resteasy.reactive.common.runtime.JaxRsSecurityConfig.denyJaxRs 和公共布尔匹配io.quarkus.resteasy.runtime.JaxRsSecurityConfig.denyJaxRs。这可能是因为您有一个不兼容的扩展组合,它们都定义了相同的属性(例如,包括反应式和阻塞式数据库扩展)

我的 pom 属性是:

<compiler-plugin.version>3.8.1</compiler-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<maven.compiler.source>12</maven.compiler.source>
<maven.compiler.target>12</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus-plugin.version>1.13.3.Final</quarkus-plugin.version>
<quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>1.13.3.Final</quarkus.platform.version>

和依赖:

  <dependencies>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-mutiny</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-vertx</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy-jsonb</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy-mutiny</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy-reactive</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-rest-client-reactive</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-jwt</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-jwt-build</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-jdbc-postgresql</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-arc</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

我只是尝试使用 Multi from mutiny 和Server Sent Elements进行流式传输:

@GET
@Produces(MediaType.SERVER_SENT_EVENTS)
@RestSseElementType(MediaType.TEXT_PLAIN)
@Path("/stream/{count}/{name}")
public Multi<String> greetingsAsStream(int count, String name) {
    return service.greetings(count, name);
}

标签: javaresteasyquarkusmutiny

解决方案


您同时拥有经典的 RESTEasy ( quarkus-resteasy-jsonb, quarkus-resteasy-mutiny) 和 RESTEasy Reactive ( quarkus-resteasy-reactive)。你需要选择一个并坚持下去。

例如,如果您想要 RESTEasy Reactive,您将删除quarkus-resteasy-mutiny(不需要额外依赖 RESTEasy Reactive),并替换quarkus-resteasy-jsonbquarkus-resteasy-reactive-jsonb.


推荐阅读