Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.此内容没有您所选择的语言版本。
53.2. JBoss Fuse CXF Implementations
Overview 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
This section describes how to use the SwaggerFeature in JBoss Fuse CXF implementations, in which REST services are defined inside JAR files and deployed to a JBoss Fuse container or a fabric8 container.
Your JBoss 6.2.1 installation contains a Quickstart (installDir
/quickstarts/cxf/rest/
) that demonstrates how to create a RESTful (JAX-RS) web service using CXF and how to enable Swagger and annotate the JAX-RS endpoints.
Enabling Swagger 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Enabling Swagger involves:
- Modifying the XML file that defines the CXF service by adding the CXF class (
io.fabric8.cxf.endpoint.SwaggerFeature
) to the<jaxrs:server>
definition.For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - In the REST resource class:
- Importing the Swagger API annotations for each annotation required by the service:
import com.wordnik.swagger.annotations.Api*
where * = Api, ApiOperation, ApiParam, ApiResponse, ApiResponses, and so on.For details, see https://github.com/swagger-api/swagger-core/wiki/Annotations. - Adding Swagger annotations to the JAX-RS annotated endpoints (@PATH, @PUT, @POST, @GET, @Produces, @Consumes, @DELETE, @PathParam, and so on).For an example, see Example 53.2, “Example REST resource with Swagger annotations”.
Building and Deploying the Rest quickstart 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
See the README file in your JBoss Fuse 6.2.1 installDir
/quickstarts/cxf/rest/
directory for instructions on how to build and deploy the rest quickstart.