Hi,
How come I can’t see Swagger’s controllers in swagger UI ?
I’ve created a simple spring-boot 2.0.2 app. These are the relevant parts in my pom.xml :
The Flowable REST API is not registered as part of the root context. Each engine registers a custom servlet with a custom configuration. Have a look at RestApiAutoConfiguration. I suppose that you somehow need to extend those configurations and hook in the swagger config.
Have you had a look at the flowable-rest application? We also have a static swagger documentation that can be used.
As I know springfox will only pick the controllers that are registered components.
So you have to add @ComponentScan(basePackages = “org.flowable.rest.service.api”)
and sample code:
@Configuration
@EnableSwagger2
@ComponentScan(basePackages = "org.flowable.rest.service.api")
public class SwaggerConfig extends WebMvcConfigurationSupport {
///process-api
@Bean
public Docket processApi() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("processAPI”)
.select()
.apis(RequestHandlerSelectors.basePackage("org.flowable.rest.service.api”))
.paths(PathSelectors.any())
.build()
.pathMapping("/process-api");
}
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html”)
.addResourceLocations("classpath:/META-INF/resources/”);
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/”);
}
}
The only drawback I see is that it will register Flowable REST APIs as part of the root context and also under /process-api, /app-api, etc. (all from RestApiAutoConfiguration)
But you can also exclude this autoconfiguration: @SpringBootApplication(exclude = { RestApiAutoConfiguration.class })
I try something similar like @eran. But I use spring-boot-starter-parent in version 2.0.0.M3 and flowable 6.4.0 but I think its no difference to your configuration. I use nearly the same swagger configuration of @rgorzkowski post. But if I start my application I run into following error.
Description:
Field restResponseFactory in org.flowable.rest.service.api.history.HistoricActivityInstanceBaseResource required a bean of type ‘org.flowable.rest.service.api.RestResponseFactory’ that could not be found.
Action:
Consider defining a bean of type ‘org.flowable.rest.service.api.RestResponseFactory’ in your configuration.
For me it sounds like a problem in flowable-rest package. Or do you have a special hint for me.
Another question to @rgorzkowski. Is the extends of WebMvcConfigurationSupport necessary and what should it do.
Hi - Is there any other way of exposing flowable resource controllers to swagger without registering components?
Also, for some reason I am unable to get a static resource handler working with flowable in spring boot? I am implementing the WebMvcConfigurer same as above but it cannot find any resources. So I had to move swagger-ui to actuator instead.