Skip to content

Commit 9ecb59e

Browse files
author
bnasslahsen
committed
Springdoc is unable to redirect to swagger-ui/index.html with Spring Boot 2.4.0-M2. Fixes #836.
1 parent 123b45e commit 9ecb59e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

springdoc-openapi-ui/src/main/java/org/springdoc/webmvc/ui/SwaggerWelcome.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.springframework.web.bind.annotation.GetMapping;
4242
import org.springframework.web.bind.annotation.ResponseBody;
4343
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
44+
import org.springframework.web.servlet.view.UrlBasedViewResolver;
4445
import org.springframework.web.util.UriComponentsBuilder;
4546

4647
import static org.springdoc.core.Constants.MVC_SERVLET_PATH;
@@ -49,7 +50,6 @@
4950
import static org.springdoc.core.Constants.SWAGGER_UI_PATH;
5051
import static org.springdoc.core.Constants.SWAGGER_UI_URL;
5152
import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR;
52-
import static org.springframework.web.servlet.view.UrlBasedViewResolver.REDIRECT_URL_PREFIX;
5353

5454
/**
5555
* The type Swagger welcome.
@@ -88,9 +88,9 @@ public SwaggerWelcome(SwaggerUiConfigProperties swaggerUiConfig, SpringDocConfig
8888
@GetMapping(SWAGGER_UI_PATH)
8989
public String redirectToUi(HttpServletRequest request) {
9090
buildConfigUrl(request.getContextPath(), ServletUriComponentsBuilder.fromCurrentContextPath());
91-
String sbUrl = REDIRECT_URL_PREFIX + swaggerUiConfigParameters.getUiRootPath() + SWAGGER_UI_URL;
91+
String sbUrl = swaggerUiConfigParameters.getUiRootPath() + SWAGGER_UI_URL;
9292
UriComponentsBuilder uriBuilder = getUriComponentsBuilder(sbUrl);
93-
return uriBuilder.build().encode().toString();
93+
return UrlBasedViewResolver.REDIRECT_URL_PREFIX + uriBuilder.build().encode().toString();
9494
}
9595

9696
/**

0 commit comments

Comments
 (0)