Quarkus反应式 - 名称为“security.jaxrs.deny-unannotated-endpoints”的属性存在多个匹配项错误。

4

在使用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);
}
2个回答

9

你可以选择使用传统的RESTEasy (quarkus-resteasy-jsonb, quarkus-resteasy-mutiny),也可以选择使用RESTEasy Reactive (quarkus-resteasy-reactive)。 但是你需要选择其中之一并保持一致。

例如,如果你想要使用RESTEasy Reactive,你应该移除quarkus-resteasy-mutiny(RESTEasy Reactive不需要额外的依赖),并将quarkus-resteasy-jsonb替换为quarkus-resteasy-reactive-jsonb


1
进一步说,Quarkus 2.x 中的错误信息更好,可以告诉您实际问题所在。 - geoand

0
I am facing a similar problem:

java.lang.RuntimeException: java.lang.IllegalArgumentException: 名称为“security.jaxrs.deny-unannotated-endpoints”的多个匹配属性,既公共布尔值io.quarkus.resteasy.reactive.common.runtime.JaxRsSecurityConfig.denyJaxRs,又公共布尔值io.quarkus.resteasy.runtime.JaxRsSecurityConfig.denyJaxRs。这可能是因为您同时包含了定义相同属性的不兼容扩展(例如,包括反应式和阻塞数据库扩展)。
I am using Swagger OpenAPIGenerate:

generatorName.set("jaxrs-spec")

Gradle dependencies:

依赖项 {

 implementation(Libs.quarkus_resteasy){
    exclude(group = "io-quarkus", module = "quarkus-resteasy-runtime")
}
 implementationList(LibGroups.quarkus_rest_server)
}
 Libs.quarkus_resteasy
>  val quarkus_resteasy = "io.quarkus:quarkus-resteasy"

LibGroups.quarkus_rest_server
>val quarkus_rest_server = listOf(
> >     "io.quarkus:quarkus-vertx",
> >     "io.quarkus:quarkus-resteasy-reactive-jackson"      
> >     //"io.quarkus:quarkus-resteasy-reactive"
>  )

After excluding the clashing module, I am still getting the same error. 
Any poin

你移除了"io.quarkus:quarkus-resteasy"吗? - Daniel Sobrado
不,它也在那里。所以我有所有这些"io.quarkus:quarkus-resteasy"和"io.quarkus:quarkus-resteasy-reactive-jackson"和"io.quarkus:quarkus-resteasy-reactive",因此出现了冲突属性的错误消息。 - Niddhi Garg
你尝试过移除 "io.quarkus:quarkus-resteasy" 吗? - Daniel Sobrado

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接