93
93
import org .springframework .web .servlet .resource .ResourceHttpRequestHandler ;
94
94
import org .springframework .web .servlet .resource .ResourceResolver ;
95
95
import org .springframework .web .servlet .resource .ResourceTransformer ;
96
+ import org .springframework .web .servlet .resource .ResourceUrlProvider ;
97
+ import org .springframework .web .servlet .resource .ResourceUrlProviderExposingInterceptor ;
96
98
import org .springframework .web .servlet .resource .VersionResourceResolver ;
97
99
import org .springframework .web .servlet .theme .ThemeChangeInterceptor ;
98
100
import org .springframework .web .servlet .view .groovy .GroovyMarkupConfigurer ;
@@ -288,7 +290,7 @@ public void testInterceptors() throws Exception {
288
290
289
291
@ Test
290
292
public void testResources () throws Exception {
291
- loadBeanDefinitions ("mvc-config-resources.xml" , 7 );
293
+ loadBeanDefinitions ("mvc-config-resources.xml" , 9 );
292
294
293
295
HttpRequestHandlerAdapter adapter = appContext .getBean (HttpRequestHandlerAdapter .class );
294
296
assertNotNull (adapter );
@@ -304,6 +306,13 @@ public void testResources() throws Exception {
304
306
assertNotNull (beanNameMapping );
305
307
assertEquals (2 , beanNameMapping .getOrder ());
306
308
309
+ ResourceUrlProvider urlProvider = appContext .getBean (ResourceUrlProvider .class );
310
+ assertNotNull (urlProvider );
311
+
312
+ MappedInterceptor mappedInterceptor = appContext .getBean (MappedInterceptor .class );
313
+ assertNotNull (urlProvider );
314
+ assertEquals (ResourceUrlProviderExposingInterceptor .class , mappedInterceptor .getInterceptor ().getClass ());
315
+
307
316
MockHttpServletRequest request = new MockHttpServletRequest ();
308
317
request .setRequestURI ("/resources/foo.css" );
309
318
request .setMethod ("GET" );
@@ -321,7 +330,7 @@ public void testResources() throws Exception {
321
330
322
331
@ Test
323
332
public void testResourcesWithOptionalAttributes () throws Exception {
324
- loadBeanDefinitions ("mvc-config-resources-optional-attrs.xml" , 7 );
333
+ loadBeanDefinitions ("mvc-config-resources-optional-attrs.xml" , 9 );
325
334
326
335
SimpleUrlHandlerMapping mapping = appContext .getBean (SimpleUrlHandlerMapping .class );
327
336
assertNotNull (mapping );
@@ -336,7 +345,7 @@ public void testResourcesWithOptionalAttributes() throws Exception {
336
345
337
346
@ Test
338
347
public void testResourcesWithResolversTransformers () throws Exception {
339
- loadBeanDefinitions ("mvc-config-resources-chain.xml" , 8 );
348
+ loadBeanDefinitions ("mvc-config-resources-chain.xml" , 10 );
340
349
341
350
SimpleUrlHandlerMapping mapping = appContext .getBean (SimpleUrlHandlerMapping .class );
342
351
assertNotNull (mapping );
@@ -374,7 +383,7 @@ public void testResourcesWithResolversTransformers() throws Exception {
374
383
375
384
@ Test
376
385
public void testResourcesWithResolversTransformersCustom () throws Exception {
377
- loadBeanDefinitions ("mvc-config-resources-chain-no-auto.xml" , 9 );
386
+ loadBeanDefinitions ("mvc-config-resources-chain-no-auto.xml" , 11 );
378
387
379
388
SimpleUrlHandlerMapping mapping = appContext .getBean (SimpleUrlHandlerMapping .class );
380
389
assertNotNull (mapping );
@@ -743,7 +752,7 @@ public void testViewResolutionWithContentNegotiation() throws Exception {
743
752
744
753
@ Test
745
754
public void testPathMatchingHandlerMappings () throws Exception {
746
- loadBeanDefinitions ("mvc-config-path-matching-mappings.xml" , 20 );
755
+ loadBeanDefinitions ("mvc-config-path-matching-mappings.xml" , 22 );
747
756
748
757
RequestMappingHandlerMapping requestMapping = appContext .getBean (RequestMappingHandlerMapping .class );
749
758
assertNotNull (requestMapping );
0 commit comments