Search code examples
wildflyresteasy

Necessity for declaring RestEasy dependencies although bundled with WildFly?


According to the RESTEasy modules in WildFly documentation:

In WildFly, RESTEasy and the JAX-RS API are automatically loaded into your deployment's classpath if and only if you are deploying a JAX-RS application (as determined by the presence of JAX-RS annotations).

However I don't really understand this paragraph. What does it exactly mean? As an exmaple, let's say I want to use ResteasyClient in a class. My IDE tells me that I must add this dependency in the corresponding pom.xml. But then how does that go with the above quote?

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

My pom.xml already includes this:

<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>

When looking at this BOM it looks as if the resteasy-client is already included?


Solution

  • My IDE tells me that I must add this dependency in the corresponding pom.xml

    Yes, you must declare this dependency in your pom.xml if you use the API of it, but you only need provided-scope, because as the documentation said, it is already included in your deployment's classpath. If you use only the standard api defined in wildfly-jakartaee8, you do not need this dependency.