Skip to content

Commit 455864b

Browse files
committed
Allow 'servet.path' with path pattern parser
Remove the restriction previously prevented `spring.mvc.servlet.path` from being combined with a `spring.mvc.pathmatch.matching-strategy` of `PATH_PATTERN_PARSER`. Spring Framework supports this combination as of v5.3.4. See gh-24805
1 parent 4d510d3 commit 455864b

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,6 @@ public void checkConfiguration() {
251251
throw new IncompatibleConfigurationException("spring.mvc.pathmatch.matching-strategy",
252252
"spring.mvc.pathmatch.use-registered-suffix-pattern");
253253
}
254-
if (!this.getServlet().getServletMapping().equals("/")) {
255-
throw new IncompatibleConfigurationException("spring.mvc.pathmatch.matching-strategy",
256-
"spring.mvc.servlet.path");
257-
}
258254
}
259255
}
260256

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcPropertiesTests.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -80,14 +80,6 @@ void incompatiblePathMatchRegisteredSuffixConfig() {
8080
.isThrownBy(this.properties::checkConfiguration);
8181
}
8282

83-
@Test
84-
void incompatiblePathMatchServletPathConfig() {
85-
this.properties.getPathmatch().setMatchingStrategy(WebMvcProperties.MatchingStrategy.PATH_PATTERN_PARSER);
86-
this.properties.getServlet().setPath("/test");
87-
assertThatExceptionOfType(IncompatibleConfigurationException.class)
88-
.isThrownBy(this.properties::checkConfiguration);
89-
}
90-
9183
private void bind(String name, String value) {
9284
bind(Collections.singletonMap(name, value));
9385
}

0 commit comments

Comments
 (0)