File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -961,6 +961,35 @@ class WebConfig {
961961}
962962` ` `
963963
964+ # ## Trailing Slash URL Matching Removed
965+
966+ ` PathMatchConfigurer#setUseTrailingSlashMatch(true)` is **removed** in Spring Framework 7 / Spring Boot 4.
967+ There is no replacement configuration knob — `/foo` and `/foo/` are no longer treated as the same route.
968+
969+ **Migration:** register Spring Framework's `UrlHandlerFilter` as a
970+ ` FilterRegistrationBean` so it runs ahead of the security chain. `wrapRequest()` makes it forward transparently (no
971+ redirect), preserving the old behavior end-to-end :
972+
973+ ` ` ` java
974+ import org.springframework.boot.web.servlet.FilterRegistrationBean;
975+ import org.springframework.web.filter.UrlHandlerFilter;
976+
977+ @Configuration
978+ class WebConfig {
979+
980+ // After ForwardedHeaderFilter, before ServletRequestPathFilter and security filters.
981+ private static final int BEFORE_SECURITY_FILTER_ORDER = -101;
982+
983+ @Bean
984+ FilterRegistrationBean<UrlHandlerFilter> trailingSlashHandlerFilter() {
985+ UrlHandlerFilter filter = UrlHandlerFilter.trailingSlashHandler("/**").wrapRequest().build();
986+ FilterRegistrationBean<UrlHandlerFilter> registration = new FilterRegistrationBean<>(filter);
987+ registration.setOrder(BEFORE_SECURITY_FILTER_ORDER);
988+ return registration;
989+ }
990+ }
991+ ` ` `
992+
964993# ## Jersey and Jackson 3 Incompatibility
965994
966995**Jersey 4.0 limitation:** Spring Boot 4.0 supports Jersey 4.0, which **does not yet support Jackson 3**.
You can’t perform that action at this time.
0 commit comments