Springfox swagger-ui.html not loading using version 3.0.0-SNAPSHOT
See original GitHub issueIn our project we are using 3.0.0-SNAPSHOT of swagger springfox.
Recently when we open swagger-ui.html, it is giving 404 Whilte Label Error.
I enabled logs at web level
`
logging.level.web=TRACE
logging.level.org.springframework.web=TRACE
`
It is loading “/swagger-resources”, but not loading “/swagger-ui.html”
The addition of the resource handler is as per the document.
When loading “/swagger-ui.html”, it’s giving “Resource not found”
`
web.server.adapter.HttpWebHandlerAdapter.traceDebug - [74c4396b] HTTP GET "/swagger-resources/", headers={masked}
web.reactive.result.method.annotation.RequestMappingHandlerMapping.lambda$getHandler$1 - [74c4396b] Mapped to public org.springframework.http.ResponseEntity<java.util.List<springfox.documentation.swagger.web.SwaggerResource>> springfox.documentation.swagger.web.ApiResourceController.swaggerResources()
web.reactive.result.method.annotation.ResponseEntityResultHandler.selectMediaType - Using 'application/json;q=0.8' given [text/html, application/xhtml+xml, image/webp, image/apng, application/xml;q=0.9, application/signed-exchange;v=b3;q=0.9, */*;q=0.8] and supported [application/json]
web.reactive.result.method.annotation.ResponseEntityResultHandler.writeBody - [74c4396b] 0..1 [java.util.List<springfox.documentation.swagger.web.SwaggerResource>]
http.codec.json.Jackson2JsonEncoder.trace - [74c4396b] Encoding [[springfox.documentation.swagger.web.SwaggerResource@4903f26e, springfox.documentation.swagger.web.SwaggerResource@57b46085, springfox.documentation.swagger.web.SwaggerResource@4beb0f82, springfox.documentation.swagger.web.SwaggerResource@3a6db652, springfox.documentation.swagger.web.SwaggerResource@6caba3f3, springfox.documentation.swagger.web.SwaggerResource@18ef56ab, springfox.documentation.swagger.web.SwaggerResource@b6bcd2b, springfox.documentation.swagger.web.SwaggerResource@5ce32532, springfox.documentation.swagger.web.SwaggerResource@6d66b166, springfox.documentation.swagger.web.SwaggerResource@fdef86f, springfox.documentation.swagger.web.SwaggerResource@5a096e2a, springfox.documentation.swagger.web.SwaggerResource@1f060aec, springfox.documentation.swagger.web.SwaggerResource@473365eb, springfox.documentation.swagger.web.SwaggerResource@3fd6e0e2]]
web.server.adapter.HttpWebHandlerAdapter.traceDebug - [74c4396b] Completed 200 OK, headers={masked}
http.server.reactive.ReactorHttpHandlerAdapter.trace - [74c4396b] Handling completed
web.server.adapter.HttpWebHandlerAdapter.traceDebug - [74c4396b] HTTP GET "/swagger-ui.html", headers={masked}
web.reactive.handler.SimpleUrlHandlerMapping.lookupHandler - [74c4396b] Matching patterns [/swagger-ui.html**, /**]
web.reactive.handler.SimpleUrlHandlerMapping.lambda$getHandler$1 - [74c4396b] Mapped to ResourceWebHandler ["classpath:/META-INF/resources/"]
web.reactive.resource.ResourceWebHandler.lambda$handle$0 - [74c4396b] Resource not found
web.reactive.function.server.RouterFunctions.route - [74c4396b] Matched org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler$$Lambda$1372/0x00000008008bb040@10209892
web.HttpLogging.debug - [74c4396b] Resolved [ResponseStatusException: 404 NOT_FOUND] for HTTP GET /swagger-ui.html
core.codec.CharSequenceEncoder.trace - [74c4396b] Writing "<html><body><h1>Whitelabel Error Page</h1><p>This application has no configured error view, so you are seeing this as a fallback.</p><div id='created'>Thu Jul 02 22:15:45 IST 2020</div><div>There was an unexpected error (type=Not Found, status=404).</div></body></html>"
web.server.adapter.HttpWebHandlerAdapter.traceDebug - [74c4396b] Completed 404 NOT_FOUND, headers={masked}
http.server.reactive.ReactorHttpHandlerAdapter.trace - [74c4396b] Handling completed
`
I checked if path inside META-INF is changed or not as per documentation at https://springfox.github.io/springfox/docs/snapshot/#snapshot-3, it is same as V 2.10.5
Then, when I changed version from V 3 Snapshot to current stable 2.10.5, it worked.
Can you let me know what I am missing? And since I am a noobie, can you tell me is snapshot version is like beta version which should not be used in production?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:25 (3 by maintainers)
Top GitHub Comments
In spring boot it works by simply adding this, no other dependencies needed:
<dependency> <groupId>io.springfox</groupId> <artifactId>springfox-boot-starter</artifactId> <version>3.0.0</version> </dependency>
The url is /swagger-ui/ , mind the final slash.I use 3.0.0 and find the new swagger ui is http://xxxx:port/swagger-ui/ ( please remember the last splash). actually, you can add spring-boot-starter-actuator and confirm the swagger ui mapping by check http://xxx:port/actuator/mappings . And my suggestion is restore the url to swagger-ui.html.