Skip to content

Commit a22a7c5

Browse files
committed
swaggerWelcome `WebFluxProperties' that could not be found. Fixes #1047.
1 parent 57feb88 commit a22a7c5

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ public class SwaggerConfig implements WebFluxConfigurer {
6565
* @param swaggerUiConfig the swagger ui config
6666
* @param springDocConfigProperties the spring doc config properties
6767
* @param swaggerUiConfigParameters the swagger ui config parameters
68+
* @param optionalWebFluxProperties the optional web flux properties
6869
* @return the swagger welcome web flux
6970
*/
7071
@Bean
7172
@ConditionalOnMissingBean
7273
@ConditionalOnProperty(name = SPRINGDOC_USE_MANAGEMENT_PORT, havingValue = "false", matchIfMissing = true)
73-
SwaggerWelcomeWebFlux swaggerWelcome(SwaggerUiConfigProperties swaggerUiConfig, SpringDocConfigProperties springDocConfigProperties,SwaggerUiConfigParameters swaggerUiConfigParameters, WebFluxProperties webFluxProperties) {
74-
return new SwaggerWelcomeWebFlux(swaggerUiConfig,springDocConfigProperties,swaggerUiConfigParameters,webFluxProperties);
74+
SwaggerWelcomeWebFlux swaggerWelcome(SwaggerUiConfigProperties swaggerUiConfig, SpringDocConfigProperties springDocConfigProperties,SwaggerUiConfigParameters swaggerUiConfigParameters, Optional<WebFluxProperties> optionalWebFluxProperties) {
75+
return new SwaggerWelcomeWebFlux(swaggerUiConfig,springDocConfigProperties,swaggerUiConfigParameters,optionalWebFluxProperties);
7576
}
7677

7778
/**

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
package org.springdoc.webflux.ui;
2222

2323
import java.util.Map;
24+
import java.util.Optional;
2425

2526
import io.swagger.v3.oas.annotations.Operation;
27+
import org.apache.commons.lang3.StringUtils;
2628
import org.springdoc.core.SpringDocConfigProperties;
2729
import org.springdoc.core.SwaggerUiConfigParameters;
2830
import org.springdoc.core.SwaggerUiConfigProperties;
@@ -50,19 +52,19 @@ public class SwaggerWelcomeWebFlux extends SwaggerWelcomeCommon {
5052
/**
5153
* The Webflux base path.
5254
*/
53-
private String webfluxBasePath;
55+
private String webfluxBasePath = StringUtils.EMPTY ;
5456

5557
/**
5658
* Instantiates a new Swagger welcome.
5759
*
5860
* @param swaggerUiConfig the swagger ui config
5961
* @param springDocConfigProperties the spring doc config properties
6062
* @param swaggerUiConfigParameters the swagger ui config parameters
61-
* @param webFluxProperties the web flux properties
63+
* @param webFluxPropertiesOptional the web flux properties
6264
*/
63-
public SwaggerWelcomeWebFlux(SwaggerUiConfigProperties swaggerUiConfig, SpringDocConfigProperties springDocConfigProperties, SwaggerUiConfigParameters swaggerUiConfigParameters, WebFluxProperties webFluxProperties) {
65+
public SwaggerWelcomeWebFlux(SwaggerUiConfigProperties swaggerUiConfig, SpringDocConfigProperties springDocConfigProperties, SwaggerUiConfigParameters swaggerUiConfigParameters, Optional<WebFluxProperties> webFluxPropertiesOptional) {
6466
super(swaggerUiConfig, springDocConfigProperties, swaggerUiConfigParameters);
65-
webfluxBasePath = webFluxProperties.getBasePath();
67+
webFluxPropertiesOptional.ifPresent(webFluxProperties -> webfluxBasePath = webFluxProperties.getBasePath());
6668
}
6769

6870
/**

0 commit comments

Comments
 (0)