Skip to content

Commit f93a53e

Browse files
committed
Enhance swagger-ui access. Fixes #1384
1 parent 1f64a8d commit f93a53e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

springdoc-openapi-common/src/main/java/org/springdoc/ui/AbstractSwaggerWelcome.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.springdoc.core.SwaggerUiConfigParameters;
2727
import org.springdoc.core.SwaggerUiConfigProperties;
2828

29-
import org.springframework.beans.factory.InitializingBean;
3029
import org.springframework.util.CollectionUtils;
3130
import org.springframework.web.util.UriComponentsBuilder;
3231

@@ -41,7 +40,7 @@
4140
* The type Abstract swagger welcome.
4241
* @author bnasslashen
4342
*/
44-
public abstract class AbstractSwaggerWelcome implements InitializingBean {
43+
public abstract class AbstractSwaggerWelcome {
4544

4645
/**
4746
* The Swagger ui configuration.
@@ -86,8 +85,7 @@ public AbstractSwaggerWelcome(SwaggerUiConfigProperties swaggerUiConfig, SpringD
8685
this.swaggerUiConfigParameters = swaggerUiConfigParameters;
8786
}
8887

89-
@Override
90-
public void afterPropertiesSet() {
88+
protected void init() {
9189
springDocConfigProperties.getGroupConfigs().forEach(groupConfig -> swaggerUiConfigParameters.addGroup(groupConfig.getGroup()));
9290
calculateUiRootPath();
9391
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ protected void calculateOauth2RedirectUrl(UriComponentsBuilder uriComponentsBuil
7474
* @param request the request
7575
*/
7676
void buildFromCurrentContextPath(HttpServletRequest request) {
77+
super.init();
7778
contextPath = request.getContextPath();
7879
buildConfigUrl(ServletUriComponentsBuilder.fromCurrentContextPath());
7980
}

springdoc-openapi-webflux-ui/src/main/java/org/springdoc/webflux/ui/SwaggerWelcomeCommon.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ protected Map<String, Object> getSwaggerUiConfig(ServerHttpRequest request) {
9696
* @return the string
9797
*/
9898
void buildFromCurrentContextPath(ServerHttpRequest request) {
99+
super.init();
99100
contextPath = request.getPath().contextPath().value();
100101
String url = UriComponentsBuilder.fromHttpRequest(request).toUriString();
101102
if (!AntPathMatcher.DEFAULT_PATH_SEPARATOR.equals(request.getPath().toString()))

0 commit comments

Comments
 (0)