...
Code Block | ||
---|---|---|
| ||
<dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-service-description-swagger</artifactId> <version>3.1.7<11</version> </dependency> |
Note that a cxf-rt-rs-service-description needs to be used if older CXF 3.1.x versions are used.
...
In the above example, go to 'http://host:port/context/services/services' and follow a Swagger link which will return a Swagger JSON document.
If CORS support is needed to access the definition from a Swagger UI on another host, the CrossOriginResourceSharingFilter from cxf-rt-rs-security-cors can be added.
Enabling Swagger UI
First one needs to add the following
Code Block | ||
---|---|---|
| ||
<dependency> <groupId>org.webjars</groupId> <artifactId>swagger-ui</artifactId> <version>2.12.810-M1<1</version> </dependency> |
The newest version 3.x of swagger-ui can also be used.
Automatic UI Activation
This feature is available starting from CXF 3.1.7: Adding a Swagger UI Maven dependency is all what is needed to start accessing Swagger documents with the help of Swagger UI.
...