Skip to content

Commit 181c64c

Browse files
fix swagger-ui prefix path
1 parent 174e4d8 commit 181c64c

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

springdoc-openapi-starter-webflux-ui/src/main/java/org/springdoc/webflux/ui/SwaggerConfig.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ SwaggerUiHome swaggerUiHome(Optional<WebFluxProperties> optionalWebFluxPropertie
119119
* Swagger web flux configurer swagger web flux configurer.
120120
*
121121
* @param swaggerUiConfigProperties the swagger ui calculated config
122-
* @param springDocConfigProperties the spring doc config properties
123122
* @param swaggerIndexTransformer the swagger index transformer
124123
* @param actuatorProvider the actuator provider
125124
* @param swaggerResourceResolver the swagger resource resolver
@@ -129,9 +128,9 @@ SwaggerUiHome swaggerUiHome(Optional<WebFluxProperties> optionalWebFluxPropertie
129128
@ConditionalOnMissingBean
130129
@Lazy(false)
131130
SwaggerWebFluxConfigurer swaggerWebFluxConfigurer(SwaggerUiConfigProperties swaggerUiConfigProperties,
132-
SpringDocConfigProperties springDocConfigProperties, SwaggerIndexTransformer swaggerIndexTransformer,
131+
SwaggerIndexTransformer swaggerIndexTransformer,
133132
Optional<ActuatorProvider> actuatorProvider, SwaggerResourceResolver swaggerResourceResolver) {
134-
return new SwaggerWebFluxConfigurer(swaggerUiConfigProperties,springDocConfigProperties, swaggerIndexTransformer, actuatorProvider, swaggerResourceResolver);
133+
return new SwaggerWebFluxConfigurer(swaggerUiConfigProperties, swaggerIndexTransformer, actuatorProvider, swaggerResourceResolver);
135134
}
136135

137136
/**

springdoc-openapi-starter-webflux-ui/src/main/java/org/springdoc/webflux/ui/SwaggerWebFluxConfigurer.java

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@
2121
* * * *
2222
* * *
2323
* *
24-
*
24+
*
2525
*/
2626

2727
package org.springdoc.webflux.ui;
2828

2929
import java.util.Optional;
3030

31-
import org.springdoc.core.properties.SpringDocConfigProperties;
3231
import org.springdoc.core.properties.SwaggerUiConfigProperties;
3332
import org.springdoc.core.providers.ActuatorProvider;
3433

@@ -38,6 +37,7 @@
3837
import static org.springdoc.core.utils.Constants.ALL_PATTERN;
3938
import static org.springdoc.core.utils.Constants.CLASSPATH_RESOURCE_LOCATION;
4039
import static org.springdoc.core.utils.Constants.DEFAULT_WEB_JARS_PREFIX_URL;
40+
import static org.springdoc.core.utils.Constants.SWAGGER_UI_PREFIX;
4141
import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR;
4242

4343
/**
@@ -67,30 +67,22 @@ public class SwaggerWebFluxConfigurer implements WebFluxConfigurer {
6767
*/
6868
private final SwaggerUiConfigProperties swaggerUiConfigProperties;
6969

70-
/**
71-
* The Spring doc config properties.
72-
*/
73-
private final SpringDocConfigProperties springDocConfigProperties;
74-
75-
/**
70+
/**
7671
* Instantiates a new Swagger web flux configurer.
7772
*
7873
* @param swaggerUiConfigProperties the swagger ui calculated config
79-
* @param springDocConfigProperties the spring doc config properties
8074
* @param swaggerIndexTransformer the swagger index transformer
8175
* @param actuatorProvider the actuator provider
8276
* @param swaggerResourceResolver the swagger resource resolver
8377
*/
8478
public SwaggerWebFluxConfigurer(SwaggerUiConfigProperties swaggerUiConfigProperties,
85-
SpringDocConfigProperties springDocConfigProperties,
86-
SwaggerIndexTransformer swaggerIndexTransformer,
79+
SwaggerIndexTransformer swaggerIndexTransformer,
8780
Optional<ActuatorProvider> actuatorProvider, SwaggerResourceResolver swaggerResourceResolver) {
8881
this.swaggerIndexTransformer = swaggerIndexTransformer;
8982
this.actuatorProvider = actuatorProvider;
9083
this.swaggerResourceResolver = swaggerResourceResolver;
9184
this.swaggerUiConfigProperties = swaggerUiConfigProperties;
92-
this.springDocConfigProperties = springDocConfigProperties;
93-
}
85+
}
9486

9587
@Override
9688
public void addResourceHandlers(ResourceHandlerRegistry registry) {
@@ -100,7 +92,7 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) {
10092
uiRootPath.append(swaggerPath, 0, swaggerPath.lastIndexOf(DEFAULT_PATH_SEPARATOR));
10193
if (actuatorProvider.isPresent() && actuatorProvider.get().isUseManagementPort())
10294
uiRootPath.append(actuatorProvider.get().getBasePath());
103-
registry.addResourceHandler(uiRootPath + springDocConfigProperties.getWebjars().getPrefix() + ALL_PATTERN)
95+
registry.addResourceHandler(uiRootPath + SWAGGER_UI_PREFIX + ALL_PATTERN)
10496
.addResourceLocations(CLASSPATH_RESOURCE_LOCATION + DEFAULT_WEB_JARS_PREFIX_URL + DEFAULT_PATH_SEPARATOR)
10597
.resourceChain(false)
10698
.addResolver(swaggerResourceResolver)

0 commit comments

Comments
 (0)