Search code examples
springspring-bootspring-integrationswagger

Swagger 2 + spring integration


I'm trying to expose rest API with Spring Integration and document it with swagger. Is it even possible ? I cannot find any docs or example to make it work.

My swagger docket bean:

Docket(DocumentationType.SWAGGER_2)
   .select()
   .apis(RequestHandlerSelectors.any())
   .paths(PathSelectors.any())
   .build();

And simple flow:

@Bean
public IntegrationFlow inbound() {
    return IntegrationFlows.from(Http.inboundGateway("/foo")
            .requestMapping(m -> m.methods(HttpMethod.GET))
            .requestPayloadType(String.class))
            .channel("httpRequest")
            .get();
}

I use spring boot:2.0.1 and springfox-swagger2 : 2.8.0

Thank in advance, Mateusz


Solution

  • Spring Integration is currently not supported by springfox, although they have provided a generalization which seems to make it possible, based upon IntegrationRequestMappingHandlerMapping: https://github.com/springfox/springfox/issues/550

    They are asking for a PR which would implement this: https://github.com/springfox/springfox/issues/797