cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: Swagger2Feature not finding @Api annotations in interfaces
Date Fri, 12 Aug 2016 22:22:58 GMT
Hi
On 12/08/16 19:28, jcrump wrote:
> No, I've not been able to make it work with the demo either.  Eventually I
> gave up and used swagger-jaxrs directly.  It was pretty straightforward once
> I figured out the secret sauce:
>
> <dependency>
>   <groupId>io.swagger</groupId>
>   <artifactId>swagger-jaxrs</artifactId>
>   <version>1.5.0</version>
>   <scope>compile</scope>
> </dependency>
>
> @Component
> public class SwaggerProvider {
>
>     @Bean
>     public SwaggerSerializers getSwaggerWriter() {
>         return new SwaggerSerializers();
>     }
>
>     @Bean
>     public ApiListingResource getApiListingResource() {
>         return new io.swagger.jaxrs.listing.ApiListingResource();
>     }
>
>     @Bean
>     public BeanConfig getSwaggerConfig() {
>         // Swagger-2.0 JSON served at:
> http://localhost:8080/xxx/swagger.json
>         BeanConfig c = new io.swagger.jaxrs.config.BeanConfig();
>         c.setResourcePackage("x.y.z.v1.rs");
>         c.setScan(true);
>         c.setDescription("Some description");
>         c.setTitle("Sometitle");
>         return c;
>     }
> }
>
> This was enough to successfully get swagger.json to be generated and made
> accessible.
>
Sure one can always do that sort of coding.
This is bizarre though why you can not make it work with Swagger2Feature 
alone, did you try to set a resourcePackage on it too ?


> Now... I just have to figure out how to get the swagger UI working with
> this.  The "easy" integrations out there don't use CXF :)
>
Oh well, the promise of the ease from some libraries that bundle 
SwaggerUI inside itself...This is I discussed with my colleagues and did 
this:

https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61318164#SwaggerFeature/Swagger2Feature-AutomaticUIActivation

Sergey

>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Swagger2Feature-not-finding-Api-annotations-in-interfaces-tp5771115p5771471.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Mime
View raw message