Deprecate use of PathMatcher and UrlPathHelper in web

Closes gh-34018
This commit is contained in:
rstoyanchev
2024-12-18 17:22:06 +00:00
parent 41a9db376d
commit 373763723e
56 changed files with 352 additions and 44 deletions

View File

@@ -188,9 +188,9 @@ public class RouterFunctionMockMvcBuilder extends AbstractMockMvcBuilder<RouterF
}
/**
* Enable URL path matching with parsed
* {@link org.springframework.web.util.pattern.PathPattern PathPatterns}
* instead of String pattern matching with a {@link org.springframework.util.PathMatcher}.
* Configure the parser to use for
* {@link org.springframework.web.util.pattern.PathPattern PathPatterns}.
* <p>By default, this is a default instance of {@link PathPatternParser}.
* @param parser the parser to use
*/
public RouterFunctionMockMvcBuilder setPatternParser(@Nullable PathPatternParser parser) {

View File

@@ -37,6 +37,7 @@ import org.springframework.format.support.DefaultFormattingConversionService;
import org.springframework.format.support.FormattingConversionService;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.mock.web.MockServletContext;
import org.springframework.util.PathMatcher;
import org.springframework.util.PropertyPlaceholderHelper;
import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver;
import org.springframework.util.StringValueResolver;
@@ -297,9 +298,9 @@ public class StandaloneMockMvcBuilder extends AbstractMockMvcBuilder<StandaloneM
}
/**
* Enable URL path matching with parsed
* {@link org.springframework.web.util.pattern.PathPattern PathPatterns}
* instead of String pattern matching with a {@link org.springframework.util.PathMatcher}.
* Configure the parser to use for
* {@link org.springframework.web.util.pattern.PathPattern PathPatterns}.
* <p>By default, this is a default instance of {@link PathPatternParser}.
* @param parser the parser to use
* @since 5.3
*/
@@ -313,7 +314,11 @@ public class StandaloneMockMvcBuilder extends AbstractMockMvcBuilder<StandaloneM
* Set if ";" (semicolon) content should be stripped from the request URI. The value,
* if provided, is in turn set on
* {@link org.springframework.web.util.UrlPathHelper#setRemoveSemicolonContent(boolean)}.
* @deprecated use of {@link PathMatcher} and {@link UrlPathHelper} is deprecated
* for use at runtime in web modules in favor of parsed patterns with
* {@link PathPatternParser}.
*/
@Deprecated(since = "7.0", forRemoval = true)
public StandaloneMockMvcBuilder setRemoveSemicolonContent(boolean removeSemicolonContent) {
this.removeSemicolonContent = removeSemicolonContent;
return this;
@@ -428,6 +433,7 @@ public class StandaloneMockMvcBuilder extends AbstractMockMvcBuilder<StandaloneM
/** Using the MVC Java configuration as the starting point for the "standalone" setup. */
private class StandaloneConfiguration extends WebMvcConfigurationSupport {
@SuppressWarnings("removal")
public RequestMappingHandlerMapping getHandlerMapping(
FormattingConversionService mvcConversionService,
ResourceUrlProvider mvcResourceUrlProvider) {