0

I am on Spring boot 3.1.0 and Spring doc 2.1.0.

Previously I was using springfox and I was forced to migrate to springdoc since springfox didn't support springboot 3.

I followed migration guide this migration guide and here's how my setup looks like.

pom.xml

    <!--Swagger dependency-->
    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
        <version>2.1.0</version>
    </dependency>

Controller

@RestController
@Slf4j
public class HelloController {
    @RequestMapping(method = RequestMethod.GET, value = "hi")
    public String hi(HttpServletRequest httpRequest) {
        return "hi";
    }
}

application.properties

#Swagger properties

server.contextPath=/ctx-path
springdoc.packagesToScan=abc.def.ghi
springdoc.paths-to-match=/hi,hi,/ctx-path/hi
springdoc.api-docs.path=/api-docs
springdoc.swagger-ui.config-url=/ctx-path/api-docs/swagger-config
springdoc.swagger-ui.disable-swagger-default-url=true

Config bean

@Configuration
public class SwaggerConfig {
    @Bean
    public OpenAPI springShopOpenAPI() {
        return new OpenAPI()
                .info(new Info().title("service-API")
                        .description("service API for UI")
                        .version("Version 1"))
                .externalDocs(new ExternalDocumentation()
                        .description("SpringShop Wiki Documentation")
                        .url("https://springshop.wiki.github.org/docs"));
    }
}

I have tried all the solutions on the internet such as setting appropriate config-url, Having @RestController, and @RequestMapping with method explicitly defined.

But I only see No API definition provided despite all the efforts. No API definition provided

Arun Gowda
  • 2,721
  • 5
  • 29
  • 50
  • Works fine for me when I have integrated new `springdoc-openapi-starter-webflux-ui:2.1.0` in my existing project, I suspect may be issue due to migration steps – dkb Jun 01 '23 at 09:04
  • Added `implementation("org.springdoc:springdoc-openapi-starter-webflux-ui:2.1.0")`, gradle plugin`id("org.springdoc.openapi-gradle-plugin") version "1.6.0"`, app.properties ```springdoc.swagger-ui.path=/swagger-ui.html springdoc.show-actuator=true springdoc.use-management-port=true springdoc.api-docs.path=/api-docs springdoc.api-docs.enabled=true``` – dkb Jun 01 '23 at 09:09

0 Answers0