@@ -214,6 +214,10 @@ public void setApplicationContext(ApplicationContext applicationContext) {
214
214
this .applicationContext = applicationContext ;
215
215
}
216
216
217
+ /**
218
+ * Return the associated Spring {@link ApplicationContext}.
219
+ * @since 4.2
220
+ */
217
221
public ApplicationContext getApplicationContext () {
218
222
return this .applicationContext ;
219
223
}
@@ -227,6 +231,10 @@ public void setServletContext(ServletContext servletContext) {
227
231
this .servletContext = servletContext ;
228
232
}
229
233
234
+ /**
235
+ * Return the associated {@link javax.servlet.ServletContext}.
236
+ * @since 4.2
237
+ */
230
238
public ServletContext getServletContext () {
231
239
return this .servletContext ;
232
240
}
@@ -267,8 +275,9 @@ public RequestMappingHandlerMapping requestMappingHandlerMapping() {
267
275
}
268
276
269
277
/**
270
- * Protected method for plugging in a custom sub-class of
278
+ * Protected method for plugging in a custom subclass of
271
279
* {@link RequestMappingHandlerMapping}.
280
+ * @since 4.0
272
281
*/
273
282
protected RequestMappingHandlerMapping createRequestMappingHandlerMapping () {
274
283
return new RequestMappingHandlerMapping ();
@@ -319,6 +328,32 @@ protected PathMatchConfigurer getPathMatchConfigurer() {
319
328
protected void configurePathMatch (PathMatchConfigurer configurer ) {
320
329
}
321
330
331
+ /**
332
+ * Return a global {@link PathMatcher} instance for path matching
333
+ * patterns in {@link HandlerMapping}s.
334
+ * This instance can be configured using the {@link PathMatchConfigurer}
335
+ * in {@link #configurePathMatch(PathMatchConfigurer)}.
336
+ * @since 4.1
337
+ */
338
+ @ Bean
339
+ public PathMatcher mvcPathMatcher () {
340
+ PathMatcher pathMatcher = getPathMatchConfigurer ().getPathMatcher ();
341
+ return (pathMatcher != null ? pathMatcher : new AntPathMatcher ());
342
+ }
343
+
344
+ /**
345
+ * Return a global {@link UrlPathHelper} instance for path matching
346
+ * patterns in {@link HandlerMapping}s.
347
+ * This instance can be configured using the {@link PathMatchConfigurer}
348
+ * in {@link #configurePathMatch(PathMatchConfigurer)}.
349
+ * @since 4.1
350
+ */
351
+ @ Bean
352
+ public UrlPathHelper mvcUrlPathHelper () {
353
+ UrlPathHelper pathHelper = getPathMatchConfigurer ().getUrlPathHelper ();
354
+ return (pathHelper != null ? pathHelper : new UrlPathHelper ());
355
+ }
356
+
322
357
/**
323
358
* Return a {@link ContentNegotiationManager} instance to use to determine
324
359
* requested {@linkplain MediaType media types} in a given request.
@@ -416,8 +451,7 @@ public HandlerMapping resourceHandlerMapping() {
416
451
if (handlerMapping != null ) {
417
452
handlerMapping .setPathMatcher (mvcPathMatcher ());
418
453
handlerMapping .setUrlPathHelper (mvcUrlPathHelper ());
419
- handlerMapping .setInterceptors (new HandlerInterceptor [] {
420
- new ResourceUrlProviderExposingInterceptor (mvcResourceUrlProvider ())});
454
+ handlerMapping .setInterceptors (new ResourceUrlProviderExposingInterceptor (mvcResourceUrlProvider ()));
421
455
handlerMapping .setCorsConfigurations (getCorsConfigurations ());
422
456
}
423
457
else {
@@ -433,6 +467,10 @@ public HandlerMapping resourceHandlerMapping() {
433
467
protected void addResourceHandlers (ResourceHandlerRegistry registry ) {
434
468
}
435
469
470
+ /**
471
+ * A {@link ResourceUrlProvider} bean for use with the MVC dispatcher.
472
+ * @since 4.1
473
+ */
436
474
@ Bean
437
475
public ResourceUrlProvider mvcResourceUrlProvider () {
438
476
ResourceUrlProvider urlProvider = new ResourceUrlProvider ();
@@ -507,8 +545,9 @@ public RequestMappingHandlerAdapter requestMappingHandlerAdapter() {
507
545
}
508
546
509
547
/**
510
- * Protected method for plugging in a custom sub-class of
548
+ * Protected method for plugging in a custom subclass of
511
549
* {@link RequestMappingHandlerAdapter}.
550
+ * @since 4.3
512
551
*/
513
552
protected RequestMappingHandlerAdapter createRequestMappingHandlerAdapter () {
514
553
return new RequestMappingHandlerAdapter ();
@@ -598,41 +637,12 @@ protected Validator getValidator() {
598
637
return null ;
599
638
}
600
639
601
- /**
602
- * Return a global {@link PathMatcher} instance for path matching
603
- * patterns in {@link HandlerMapping}s.
604
- * This instance can be configured using the {@link PathMatchConfigurer}
605
- * in {@link #configurePathMatch(PathMatchConfigurer)}.
606
- * @since 4.1
607
- */
608
- @ Bean
609
- public PathMatcher mvcPathMatcher () {
610
- if (getPathMatchConfigurer ().getPathMatcher () != null ) {
611
- return getPathMatchConfigurer ().getPathMatcher ();
612
- }
613
- else {
614
- return new AntPathMatcher ();
615
- }
616
- }
617
-
618
- /**
619
- * Return a global {@link UrlPathHelper} instance for path matching
620
- * patterns in {@link HandlerMapping}s.
621
- * This instance can be configured using the {@link PathMatchConfigurer}
622
- * in {@link #configurePathMatch(PathMatchConfigurer)}.
623
- * @since 4.1
624
- */
625
- @ Bean
626
- public UrlPathHelper mvcUrlPathHelper () {
627
- UrlPathHelper pathHelper = getPathMatchConfigurer ().getUrlPathHelper ();
628
- return (pathHelper != null ? pathHelper : new UrlPathHelper ());
629
- }
630
-
631
640
/**
632
641
* Provide access to the shared custom argument resolvers used by the
633
642
* {@link RequestMappingHandlerAdapter} and the
634
643
* {@link ExceptionHandlerExceptionResolver}. This method cannot be
635
644
* overridden, use {@link #addArgumentResolvers(List)} instead.
645
+ * @since 4.3
636
646
*/
637
647
protected final List <HandlerMethodArgumentResolver > getArgumentResolvers () {
638
648
if (this .argumentResolvers == null ) {
@@ -661,6 +671,7 @@ protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argument
661
671
* {@link RequestMappingHandlerAdapter} and the
662
672
* {@link ExceptionHandlerExceptionResolver}. This method cannot be
663
673
* overridden, use {@link #addReturnValueHandlers(List)} instead.
674
+ * @since 4.3
664
675
*/
665
676
protected final List <HandlerMethodReturnValueHandler > getReturnValueHandlers () {
666
677
if (this .returnValueHandlers == null ) {
@@ -769,6 +780,7 @@ else if (gsonPresent) {
769
780
/**
770
781
* Return an instance of {@link CompositeUriComponentsContributor} for use with
771
782
* {@link org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder}.
783
+ * @since 4.0
772
784
*/
773
785
@ Bean
774
786
public CompositeUriComponentsContributor mvcUriComponentsContributor () {
@@ -875,8 +887,9 @@ protected final void addDefaultHandlerExceptionResolvers(List<HandlerExceptionRe
875
887
}
876
888
877
889
/**
878
- * Protected method for plugging in a custom sub-class of
890
+ * Protected method for plugging in a custom subclass of
879
891
* {@link ExceptionHandlerExceptionResolver}.
892
+ * @since 4.3
880
893
*/
881
894
protected ExceptionHandlerExceptionResolver createExceptionHandlerExceptionResolver () {
882
895
return new ExceptionHandlerExceptionResolver ();
0 commit comments