Skip to content

Commit

Permalink
Enhance swagger-ui access. Fixes #1384
Browse files Browse the repository at this point in the history
  • Loading branch information
bnasslahsen committed Dec 17, 2021
1 parent 1f64a8d commit f93a53e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.springdoc.core.SwaggerUiConfigParameters;
import org.springdoc.core.SwaggerUiConfigProperties;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.CollectionUtils;
import org.springframework.web.util.UriComponentsBuilder;

Expand All @@ -41,7 +40,7 @@
* The type Abstract swagger welcome.
* @author bnasslashen
*/
public abstract class AbstractSwaggerWelcome implements InitializingBean {
public abstract class AbstractSwaggerWelcome {

/**
* The Swagger ui configuration.
Expand Down Expand Up @@ -86,8 +85,7 @@ public AbstractSwaggerWelcome(SwaggerUiConfigProperties swaggerUiConfig, SpringD
this.swaggerUiConfigParameters = swaggerUiConfigParameters;
}

@Override
public void afterPropertiesSet() {
protected void init() {
springDocConfigProperties.getGroupConfigs().forEach(groupConfig -> swaggerUiConfigParameters.addGroup(groupConfig.getGroup()));
calculateUiRootPath();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ protected void calculateOauth2RedirectUrl(UriComponentsBuilder uriComponentsBuil
* @param request the request
*/
void buildFromCurrentContextPath(HttpServletRequest request) {
super.init();
contextPath = request.getContextPath();
buildConfigUrl(ServletUriComponentsBuilder.fromCurrentContextPath());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ protected Map<String, Object> getSwaggerUiConfig(ServerHttpRequest request) {
* @return the string
*/
void buildFromCurrentContextPath(ServerHttpRequest request) {
super.init();
contextPath = request.getPath().contextPath().value();
String url = UriComponentsBuilder.fromHttpRequest(request).toUriString();
if (!AntPathMatcher.DEFAULT_PATH_SEPARATOR.equals(request.getPath().toString()))
Expand Down

0 comments on commit f93a53e

Please sign in to comment.