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
This is my sample code.
Maven
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</dependency>
Configuration
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any())
.paths(PathSelectors.ant("/open/api/**")).build();
}
}
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