Reputation: 5241
I am developing web services for a project, and I supposed to add the dependency on a pom file for 'javax.ws.rs' and 'javax.ws.rs.core'. Since I am using Apache CXF for the required REST API Implementation. I have couple of question:
2.To implement I definitely need to use 'Apache CXF Runtime JAX RS Frontend', then what is the difference between 'javax.ws.rs' and 'Apache CXF'.
Please rephrase my question if doesn't make the sense but it makes sense in a different way.
Upvotes: 1
Views: 2288
Reputation: 1192
The same happens in other cases, like JAX-WS, where you have the API specification and you need an implementation to actually use it. In this case, the JAX-WS Reference Implementation is already included in the jdk and you would not need to provide another one, although you could provide CXF JAX-WS implementation if you wanted to.
Maven dependencies
When you use CXF or Jersey, you dont need to include a dependency explicitly for javax.ws.rs
, as it's already included as a transitive dependency for those, meaning that it will be downloaded automatically.
In your case, to use CXF you will need to add these dependencies in your pom file:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
That's all, you don't need to include any dependency for javax.ws.rs
.
Upvotes: 4