【问题标题】:Necessity for declaring RestEasy dependencies although bundled with WildFly?尽管与 WildFly 捆绑在一起,但有必要声明 RestEasy 依赖项吗?
【发布时间】:2021-02-19 22:53:49
【问题描述】:

根据RESTEasy modules in WildFly 文档:

在 WildFly 中,RESTEasy 和 JAX-RS API 会自动加载到 当且仅当您正在部署 JAX-RS 时,您的部署的类路径 应用程序(由 JAX-RS 注释的存在确定)。

但是我真的不明白这一段。它到底是什么意思?例如,假设我想在课堂上使用ResteasyClient。我的 IDE 告诉我必须在相应的 pom.xml 中添加此依赖项。但是,上面的引用又是怎么回事呢?

<dependency>
  <groupId>org.jboss.resteasy</groupId>
  <artifactId>resteasy-client</artifactId>
</dependency>

我的pom.xml 已经包含了这个:

<dependency>
    <groupId>org.wildfly.bom</groupId>
    <artifactId>wildfly-jakartaee8-with-tools</artifactId>
    <version>20.0.1.Final</version>
    <scope>import</scope>
    <type>pom</type>
</dependency>

查看this BOM 时,好像resteasy-client 已包含在内?

【问题讨论】:

    标签: wildfly resteasy


    【解决方案1】:

    我的IDE告诉我必须在对应的pom.xml中添加这个依赖

    是的,如果你使用它的 API,你必须在你的 pom.xml 中声明这个依赖,但你只需要provided-scope,因为正如文档所说,它已经包含在你的部署的类路径中。如果只使用 wildfly-jakartaee8 中定义的标准 api,则不需要此依赖。

    【讨论】:

      猜你喜欢
      • 2011-10-12
      • 2018-04-18
      • 1970-01-01
      • 1970-01-01
      • 2017-01-12
      • 1970-01-01
      • 1970-01-01
      • 2021-11-23
      • 1970-01-01
      相关资源
      最近更新 更多