user3695619
user3695619

Reputation: 21

How to do swagger server integration without swagger annotation?

I am able to integrate CXF jax-rs with swagger annotation(@Api, @ApiOperation, @ApiResponses, @ApiParam)

But I would like to integrate without @Api, @ApiOperation, @ApiResponses, @ApiParam. I have looked at following code - https://github.com/wordnik/swagger-core/tree/master/samples/java-jaxrs-no-annotations

I am not able to understand how swagger server integrates with jax-rs / scans jax-rs annotations without swagger annotations.

Upvotes: 2

Views: 2718

Answers (1)

Dimitar Ivanov
Dimitar Ivanov

Reputation: 116

First of all - the sample is present in 1.4 branch - java-jaxrs-no-annotations sample

Also, mind the drawbacks of this approach - you can found them in the original ticket for Allow scanning of non-annotated JAX-RS Resources

In short - the Bootstrap servlet uses the SwaggerConfig to set the Api information and the authorization scopes, while the real scanning of the JAX-RS annotations is configured in the web.xml - by using swagger specific configuration classes like com.wordnik.swagger.jaxrs.config.DefaultJaxrsConfig.

In order to understand these things better you can take a look at the integrating swagger into JAX-RS sample which illustrates how these configurations can be done programatically, without a web.xml

Upvotes: 1

Related Questions