Sorry for the bother. I found a solution:
- Defining a features bean
- Adding swagger2feature to it
- Proving the new feature list to cxfrs component.

```

  @Bean(name = "features")

  public List<Feature> features() {

    ServerFactoryBean sfb = new ServerFactoryBean();

    ...


    Swagger2Feature feature = new Swagger2Feature();

    feature.setBasePath("/");

    feature.setRunAsFilter(true);

    sfb.getFeatures().add(feature);


    return sfb.getFeatures();

  }

```

And then in CXFRS component:

```
   from("cxfrs:...?features=#features&...")
```

On Mon, Feb 26, 2018 at 12:54 PM, Okello Nelson <cn.oke...@gmail.com> wrote:

> I've read in a number of places that the way to integrate Swagger with
> Camel CXFRS is by using `Swagger2Feature`. I already have a working Camel
> CXFRS service whose API docs I'd like to access through a URL.
>
> From what I've seen this is supposed to be done like this:
>
> ```
>
>     Swagger2Feature feature = new Swagger2Feature();
>
>     feature.setBasePath("/api");
>
>     feature.setRunAsFilter(true);
>
>
>
>     ServerFactoryBean sfb = new ServerFactoryBean();
>
>     sfb.getFeatures().add(feature);
> ```
>
> I'm assuming this code is correct. Please feel free to point out if you
> think it's not.
>
> In all the threads I've gone through, I can't see where this code is meant
> to be placed. Is it supposed to be in the class where the routes are
> defined? If so, is it supposed to come before or after route definition.
> Are there any other configuration I need to make for it to work?
>
> --
> Kind Regards,
> Okello Nelson
> cn.oke...@gmail.com
>



-- 
Kind Regards,
Okello Nelson
+254 722 137 826
cn.oke...@gmail.com

Reply via email to