DAIRAV
DAIRAV

Reputation: 731

Rest Easy Swagger api documentation

In my application restful services created using Reast-Easy. Am trying to document restful services using io.springfox:springfox-swagger2:2.9.2 and io.springfox:springfox-swagger-ui:2.9.2

Is this correct approach?

When i tried, am getting swagger UI page but getting "No Operations defined in Spec!"

From the logs, am getting below exception,

javax.ws.rs.NotFoundException: RESTEASY003210: Could not find resource for full path: http://localhost:8080/test/
        at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:61)
        at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:47)

Swagger Configuration:

@Configuration
@EnableSwagger2
public class SwaggerConfig extends WebMvcConfigurationSupport {

    @Bean
    public Docket apiMonitoramento() {
        return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any()).build().apiInfo(apiInfo());
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("REST API").description("REST API").build();
    }

    @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/");
    }

}

Is any issue in configuration ? Could you please help me out in this?

Upvotes: 1

Views: 731

Answers (1)

Mark Bramnik
Mark Bramnik

Reputation: 42431

Springfox-swagger does not support RestEasy bindings as stated in this issue description

Its primarily intended to scan and build its model out of Spring Web MVC controllers.

Upvotes: 1

Related Questions