diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/VersionRequestCondition.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/VersionRequestCondition.java index e3dbb29237d1..5dcd71e6991d 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/VersionRequestCondition.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/VersionRequestCondition.java @@ -100,9 +100,12 @@ public VersionRequestCondition combine(VersionRequestCondition other) { @Override public @Nullable VersionRequestCondition getMatchingCondition(ServerWebExchange exchange) { + if (this.version == null) { + return this; + } ApiVersionHolder versionHolder = exchange.getRequiredAttribute(HandlerMapping.API_VERSION_ATTRIBUTE); - if (this.version == null || !versionHolder.hasVersion()) { + if (!versionHolder.hasVersion()) { return this; }