Skip to content

Getting 404 when trying to access swagger-ui of a native spring-boot app #1394

Closed
@ivangfr

Description

@ivangfr

Describe the bug
After updating my spring-boot project to 2.6.1 and springdoc-openapi to 1.6.1, compiling and starting successfully the Docker native container, when trying to access the swagger-ui, the website doesn't open and a 404 is returned.

To Reproduce

Expected behavior

  • The swagger-ui.html website should open

Screenshots

Screenshot 2021-12-17 at 10 17 28

Additional context
The http://localhost:8080/v3/api-docs works and returns

{
	"openapi":"3.0.1",
	"info":{"title":"game-score-api"},
	"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],
	"tags":[{"name":"Actuator","description":"Monitor and interact","externalDocs":{"description":"Spring Boot Actuator Web API Documentation","url":"https://docs.spring.io/spring-boot/docs/current/actuator-api/html/"}}],
	"paths":{
		"/api/games":{"get":{"tags":["game-score-controller"],"operationId":"getGameScores","parameters":[{"name":"title","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/PageGameScoreResponse"}}}}}}},
		"/api/games/{id}":{"get":{"tags":["game-score-controller"],"operationId":"getGameScore","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/GameScoreResponse"}}}}}}},
		"/actuator":{"get":{"tags":["Actuator"],"summary":"Actuator root web endpoint","operationId":"links_1","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Link"}}}}}}}}},
		"/actuator/metrics":{"get":{"tags":["Actuator"],"summary":"Actuator web endpoint 'metrics'","operationId":"metrics_2","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}}}}},
		"/actuator/metrics/{requiredMetricName}":{"get":{"tags":["Actuator"],"summary":"Actuator web endpoint 'metrics-requiredMetricName'","operationId":"metrics-requiredMetricName_2","parameters":[{"name":"requiredMetricName","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}}}}},
		"/actuator/mappings":{"get":{"tags":["Actuator"],"summary":"Actuator web endpoint 'mappings'","operationId":"mappings_2","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}}}}},
		"/actuator/info":{"get":{"tags":["Actuator"],"summary":"Actuator web endpoint 'info'","operationId":"info_2","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}}}}},
		"/actuator/health":{"get":{"tags":["Actuator"],"summary":"Actuator web endpoint 'health'","operationId":"health_2","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}}}}},
		"/actuator/health/**":{"get":{"tags":["Actuator"],"summary":"Actuator web endpoint 'health-path'","operationId":"health-path_2","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}}}}},
		"/actuator/env":{"get":{"tags":["Actuator"],"summary":"Actuator web endpoint 'env'","operationId":"env_2","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}}}}},
		"/actuator/env/{toMatch}":{"get":{"tags":["Actuator"],"summary":"Actuator web endpoint 'env-toMatch'","operationId":"env-toMatch_2","parameters":[{"name":"toMatch","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}}}}},
		"/actuator/beans":{"get":{"tags":["Actuator"],"summary":"Actuator web endpoint 'beans'","operationId":"beans_2","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}}}}}},
		"components":{"schemas":{"GameScoreResponse":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"title":{"type":"string"},"score":{"type":"integer","format":"int32"}}},"PageGameScoreResponse":{"type":"object","properties":{"totalElements":{"type":"integer","format":"int64"},"totalPages":{"type":"integer","format":"int32"},"numberOfElements":{"type":"integer","format":"int32"},"first":{"type":"boolean"},"last":{"type":"boolean"},"sort":{"$ref":"#/components/schemas/Sort"},"size":{"type":"integer","format":"int32"},"content":{"type":"array","items":{"$ref":"#/components/schemas/GameScoreResponse"}},"number":{"type":"integer","format":"int32"},"pageable":{"$ref":"#/components/schemas/Pageable"},"empty":{"type":"boolean"}}},"Pageable":{"type":"object"},"Sort":{"type":"object","properties":{"empty":{"type":"boolean"}}},"Link":{"type":"object","properties":{"href":{"type":"string"},"templated":{"type":"boolean"}}}}}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions