0

I am trying to integrate openApi with swagger in my spring boot application. The swagger UI loads, however it is not finding the swaggerjson file it needs to render the page.

I added the below dependencies:

        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.5.12</version>
        </dependency>
        <!-- required for swagger-ui integration -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version>
        </dependency>

Here is my Configuration class:

@Configuration
public class SwaggerConfig {
    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI().info(new Info()
                .title("Service API")
                .version("1")
                .description("Service"));
    }
}

Here is the error:

Ambiguous handler methods mapped for '/v3/api-docs': {public org.springframework.http.ResponseEntity springfox.documentation.oas.web.OpenApiControllerWebMvc.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest), public java.lang.String org.springdoc.webmvc.api.OpenApiWebMvcResource.openapiJson(javax.servlet.http.HttpServletRequest,java.lang.String,java.util.Locale) throws com.fasterxml.jackson.core.JsonProcessingException

Helen
  • 87,344
  • 17
  • 243
  • 314
AhmedBakran
  • 135
  • 1
  • 8

1 Answers1

3

I don't think you can use those dependencies together. They both do the same thing which means you are getting the 'ambiguous' error. This has some details on migrating from springfox.

Hopey One
  • 1,681
  • 5
  • 10