File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -128,9 +128,10 @@ else if (this.version != null && otherVersion != null) {
128
128
return (-1 * compareVersions (this .version , otherVersion ));
129
129
}
130
130
else {
131
- // Prefer mapping without version for unversioned request
131
+ // Prefer mappings with a version unless the request is without a version
132
+ int result = this .version != null ? -1 : 1 ;
132
133
Comparable <?> version = exchange .getAttribute (HandlerMapping .API_VERSION_ATTRIBUTE );
133
- return (version != null ? ( this . version ! = null ? -1 : 1 ) : ( this . version != null ? 1 : - 1 ) );
134
+ return (version = = null ? -1 * result : result );
134
135
}
135
136
}
136
137
Original file line number Diff line number Diff line change @@ -127,9 +127,10 @@ else if (this.version != null && otherVersion != null) {
127
127
return (-1 * compareVersions (this .version , otherVersion ));
128
128
}
129
129
else {
130
- // Prefer mapping without version for unversioned request
130
+ // Prefer mappings with a version unless the request is without a version
131
+ int result = this .version != null ? -1 : 1 ;
131
132
Comparable <?> version = (Comparable <?>) request .getAttribute (HandlerMapping .API_VERSION_ATTRIBUTE );
132
- return (version != null ? ( this . version ! = null ? -1 : 1 ) : ( this . version != null ? 1 : - 1 ) );
133
+ return (version = = null ? -1 * result : result );
133
134
}
134
135
}
135
136
You can’t perform that action at this time.
0 commit comments