|
46 | 46 | import org.springframework.web.bind.annotation.RestController;
|
47 | 47 | import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
48 | 48 | import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
| 49 | +import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; |
| 50 | +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
49 | 51 |
|
50 | 52 | import static org.assertj.core.api.Assertions.assertThat;
|
51 | 53 | import static org.mockito.Mockito.spy;
|
@@ -292,7 +294,7 @@ public RoleHierarchy roleHiearchy() {
|
292 | 294 |
|
293 | 295 | @Test
|
294 | 296 | public void mvcMatcher() throws Exception {
|
295 |
| - loadConfig(MvcMatcherConfig.class); |
| 297 | + loadConfig(MvcMatcherConfig.class, LegacyMvcMatchingConfig.class); |
296 | 298 |
|
297 | 299 | this.request.setRequestURI("/path");
|
298 | 300 | this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain);
|
@@ -350,7 +352,7 @@ public String path() {
|
350 | 352 |
|
351 | 353 | @Test
|
352 | 354 | public void requestWhenMvcMatcherDenyAllThenRespondsWithUnauthorized() throws Exception {
|
353 |
| - loadConfig(MvcMatcherInLambdaConfig.class); |
| 355 | + loadConfig(MvcMatcherInLambdaConfig.class, LegacyMvcMatchingConfig.class); |
354 | 356 |
|
355 | 357 | this.request.setRequestURI("/path");
|
356 | 358 | this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain);
|
@@ -410,7 +412,7 @@ public String path() {
|
410 | 412 |
|
411 | 413 | @Test
|
412 | 414 | public void mvcMatcherServletPath() throws Exception {
|
413 |
| - loadConfig(MvcMatcherServletPathConfig.class); |
| 415 | + loadConfig(MvcMatcherServletPathConfig.class, LegacyMvcMatchingConfig.class); |
414 | 416 |
|
415 | 417 | this.request.setServletPath("/spring");
|
416 | 418 | this.request.setRequestURI("/spring/path");
|
@@ -487,7 +489,7 @@ public String path() {
|
487 | 489 |
|
488 | 490 | @Test
|
489 | 491 | public void requestWhenMvcMatcherServletPathDenyAllThenMatchesOnServletPath() throws Exception {
|
490 |
| - loadConfig(MvcMatcherServletPathInLambdaConfig.class); |
| 492 | + loadConfig(MvcMatcherServletPathInLambdaConfig.class, LegacyMvcMatchingConfig.class); |
491 | 493 |
|
492 | 494 | this.request.setServletPath("/spring");
|
493 | 495 | this.request.setRequestURI("/spring/path");
|
@@ -697,6 +699,14 @@ public String path() {
|
697 | 699 | }
|
698 | 700 | }
|
699 | 701 |
|
| 702 | + @Configuration |
| 703 | + static class LegacyMvcMatchingConfig implements WebMvcConfigurer { |
| 704 | + @Override |
| 705 | + public void configurePathMatch(PathMatchConfigurer configurer) { |
| 706 | + configurer.setUseSuffixPatternMatch(true); |
| 707 | + } |
| 708 | + } |
| 709 | + |
700 | 710 | public void loadConfig(Class<?>... configs) {
|
701 | 711 | this.context = new AnnotationConfigWebApplicationContext();
|
702 | 712 | this.context.register(configs);
|
|
0 commit comments