0

I am following this to integrate springdoc in my springboot application.

Springboot version is 3.3.1 and I have added dependency:

<dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
            <version>2.5.0</version>
</dependency>

Dependency tree:

[INFO] +- org.springdoc:springdoc-openapi-starter-webmvc-ui:jar:2.5.0:compile
[INFO] |  +- org.springdoc:springdoc-openapi-starter-webmvc-api:jar:2.5.0:compile
[INFO] |  |  \- org.springdoc:springdoc-openapi-starter-common:jar:2.5.0:compile
[INFO] |  |     \- io.swagger.core.v3:swagger-core-jakarta:jar:2.2.21:compile
[INFO] |  |        +- io.swagger.core.v3:swagger-annotations-jakarta:jar:2.2.21:compile
[INFO] |  |        +- io.swagger.core.v3:swagger-models-jakarta:jar:2.2.21:compile
[INFO] |  |        \- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.17.1:compile
[INFO] |  \- org.webjars:swagger-ui:jar:5.13.0:compile

But for me none of the links work:

http://localhost:8080/v3/api-docs
http://localhost:8080/swagger-ui/index.html

Both has 'This site can’t be reached' message on browser.

Do I need any extra configuration?

1 Answer 1

1

I always define the paths explicitly:

springdoc:
  api-docs:
    path: /public/v3/api-docs
  swagger-ui:
    path: /public/swagger-ui.html

and then they will be available under localhost:8080/public/swagger-ui/index.html


Keep in mind that if you have defined the property context-path:

server:
  servlet:
    context-path: /foo-service

then it will be part of the url: localhost:8080/foo-service/public/swagger-ui/index.html


Lastly make sure you are not getting 403 because of spring security (open the network tab to see the error codes)

2
  • My application is running on port 8089. Does it impact api-docs and swagger?
    – Mandroid
    Commented Jul 10 at 9:09
  • just the localhost part, e.g. localhost:8089/public/swagger-ui/index.html
    – J Asgarov
    Commented Jul 10 at 9:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.