Skip to content

Commit

Permalink
Allow 'servet.path' with path pattern parser
Browse files Browse the repository at this point in the history
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
  • Loading branch information
philwebb committed Apr 7, 2021
1 parent 4d510d3 commit 455864b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
Expand Up @@ -251,10 +251,6 @@ public void checkConfiguration() {
throw new IncompatibleConfigurationException("spring.mvc.pathmatch.matching-strategy",
"spring.mvc.pathmatch.use-registered-suffix-pattern");
}
if (!this.getServlet().getServletMapping().equals("/")) {
throw new IncompatibleConfigurationException("spring.mvc.pathmatch.matching-strategy",
"spring.mvc.servlet.path");
}
}
}

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -80,14 +80,6 @@ void incompatiblePathMatchRegisteredSuffixConfig() {
.isThrownBy(this.properties::checkConfiguration);
}

@Test
void incompatiblePathMatchServletPathConfig() {
this.properties.getPathmatch().setMatchingStrategy(WebMvcProperties.MatchingStrategy.PATH_PATTERN_PARSER);
this.properties.getServlet().setPath("/test");
assertThatExceptionOfType(IncompatibleConfigurationException.class)
.isThrownBy(this.properties::checkConfiguration);
}

private void bind(String name, String value) {
bind(Collections.singletonMap(name, value));
}
Expand Down

0 comments on commit 455864b

Please sign in to comment.