@@ -217,6 +217,10 @@ public void setApplicationContext(ApplicationContext applicationContext) {
217
217
this .applicationContext = applicationContext ;
218
218
}
219
219
220
+ /**
221
+ * Return the associated Spring {@link ApplicationContext}.
222
+ * @since 4.2
223
+ */
220
224
public ApplicationContext getApplicationContext () {
221
225
return this .applicationContext ;
222
226
}
@@ -230,6 +234,10 @@ public void setServletContext(ServletContext servletContext) {
230
234
this .servletContext = servletContext ;
231
235
}
232
236
237
+ /**
238
+ * Return the associated {@link javax.servlet.ServletContext}.
239
+ * @since 4.2
240
+ */
233
241
public ServletContext getServletContext () {
234
242
return this .servletContext ;
235
243
}
@@ -270,8 +278,9 @@ public RequestMappingHandlerMapping requestMappingHandlerMapping() {
270
278
}
271
279
272
280
/**
273
- * Protected method for plugging in a custom sub-class of
281
+ * Protected method for plugging in a custom subclass of
274
282
* {@link RequestMappingHandlerMapping}.
283
+ * @since 4.0
275
284
*/
276
285
protected RequestMappingHandlerMapping createRequestMappingHandlerMapping () {
277
286
return new RequestMappingHandlerMapping ();
@@ -322,6 +331,32 @@ protected PathMatchConfigurer getPathMatchConfigurer() {
322
331
protected void configurePathMatch (PathMatchConfigurer configurer ) {
323
332
}
324
333
334
+ /**
335
+ * Return a global {@link PathMatcher} instance for path matching
336
+ * patterns in {@link HandlerMapping}s.
337
+ * This instance can be configured using the {@link PathMatchConfigurer}
338
+ * in {@link #configurePathMatch(PathMatchConfigurer)}.
339
+ * @since 4.1
340
+ */
341
+ @ Bean
342
+ public PathMatcher mvcPathMatcher () {
343
+ PathMatcher pathMatcher = getPathMatchConfigurer ().getPathMatcher ();
344
+ return (pathMatcher != null ? pathMatcher : new AntPathMatcher ());
345
+ }
346
+
347
+ /**
348
+ * Return a global {@link UrlPathHelper} instance for path matching
349
+ * patterns in {@link HandlerMapping}s.
350
+ * This instance can be configured using the {@link PathMatchConfigurer}
351
+ * in {@link #configurePathMatch(PathMatchConfigurer)}.
352
+ * @since 4.1
353
+ */
354
+ @ Bean
355
+ public UrlPathHelper mvcUrlPathHelper () {
356
+ UrlPathHelper pathHelper = getPathMatchConfigurer ().getUrlPathHelper ();
357
+ return (pathHelper != null ? pathHelper : new UrlPathHelper ());
358
+ }
359
+
325
360
/**
326
361
* Return a {@link ContentNegotiationManager} instance to use to determine
327
362
* requested {@linkplain MediaType media types} in a given request.
@@ -419,8 +454,7 @@ public HandlerMapping resourceHandlerMapping() {
419
454
if (handlerMapping != null ) {
420
455
handlerMapping .setPathMatcher (mvcPathMatcher ());
421
456
handlerMapping .setUrlPathHelper (mvcUrlPathHelper ());
422
- handlerMapping .setInterceptors (new HandlerInterceptor [] {
423
- new ResourceUrlProviderExposingInterceptor (mvcResourceUrlProvider ())});
457
+ handlerMapping .setInterceptors (new ResourceUrlProviderExposingInterceptor (mvcResourceUrlProvider ()));
424
458
handlerMapping .setCorsConfigurations (getCorsConfigurations ());
425
459
}
426
460
else {
@@ -436,6 +470,10 @@ public HandlerMapping resourceHandlerMapping() {
436
470
protected void addResourceHandlers (ResourceHandlerRegistry registry ) {
437
471
}
438
472
473
+ /**
474
+ * A {@link ResourceUrlProvider} bean for use with the MVC dispatcher.
475
+ * @since 4.1
476
+ */
439
477
@ Bean
440
478
public ResourceUrlProvider mvcResourceUrlProvider () {
441
479
ResourceUrlProvider urlProvider = new ResourceUrlProvider ();
@@ -512,8 +550,9 @@ public RequestMappingHandlerAdapter requestMappingHandlerAdapter() {
512
550
}
513
551
514
552
/**
515
- * Protected method for plugging in a custom sub-class of
553
+ * Protected method for plugging in a custom subclass of
516
554
* {@link RequestMappingHandlerAdapter}.
555
+ * @since 4.3
517
556
*/
518
557
protected RequestMappingHandlerAdapter createRequestMappingHandlerAdapter () {
519
558
return new RequestMappingHandlerAdapter ();
@@ -603,41 +642,12 @@ protected Validator getValidator() {
603
642
return null ;
604
643
}
605
644
606
- /**
607
- * Return a global {@link PathMatcher} instance for path matching
608
- * patterns in {@link HandlerMapping}s.
609
- * This instance can be configured using the {@link PathMatchConfigurer}
610
- * in {@link #configurePathMatch(PathMatchConfigurer)}.
611
- * @since 4.1
612
- */
613
- @ Bean
614
- public PathMatcher mvcPathMatcher () {
615
- if (getPathMatchConfigurer ().getPathMatcher () != null ) {
616
- return getPathMatchConfigurer ().getPathMatcher ();
617
- }
618
- else {
619
- return new AntPathMatcher ();
620
- }
621
- }
622
-
623
- /**
624
- * Return a global {@link UrlPathHelper} instance for path matching
625
- * patterns in {@link HandlerMapping}s.
626
- * This instance can be configured using the {@link PathMatchConfigurer}
627
- * in {@link #configurePathMatch(PathMatchConfigurer)}.
628
- * @since 4.1
629
- */
630
- @ Bean
631
- public UrlPathHelper mvcUrlPathHelper () {
632
- UrlPathHelper pathHelper = getPathMatchConfigurer ().getUrlPathHelper ();
633
- return (pathHelper != null ? pathHelper : new UrlPathHelper ());
634
- }
635
-
636
645
/**
637
646
* Provide access to the shared custom argument resolvers used by the
638
647
* {@link RequestMappingHandlerAdapter} and the
639
648
* {@link ExceptionHandlerExceptionResolver}. This method cannot be
640
649
* overridden, use {@link #addArgumentResolvers(List)} instead.
650
+ * @since 4.3
641
651
*/
642
652
protected final List <HandlerMethodArgumentResolver > getArgumentResolvers () {
643
653
if (this .argumentResolvers == null ) {
@@ -666,6 +676,7 @@ protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argument
666
676
* {@link RequestMappingHandlerAdapter} and the
667
677
* {@link ExceptionHandlerExceptionResolver}. This method cannot be
668
678
* overridden, use {@link #addReturnValueHandlers(List)} instead.
679
+ * @since 4.3
669
680
*/
670
681
protected final List <HandlerMethodReturnValueHandler > getReturnValueHandlers () {
671
682
if (this .returnValueHandlers == null ) {
@@ -774,6 +785,7 @@ else if (gsonPresent) {
774
785
/**
775
786
* Return an instance of {@link CompositeUriComponentsContributor} for use with
776
787
* {@link org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder}.
788
+ * @since 4.0
777
789
*/
778
790
@ Bean
779
791
public CompositeUriComponentsContributor mvcUriComponentsContributor () {
@@ -880,8 +892,9 @@ protected final void addDefaultHandlerExceptionResolvers(List<HandlerExceptionRe
880
892
}
881
893
882
894
/**
883
- * Protected method for plugging in a custom sub-class of
895
+ * Protected method for plugging in a custom subclass of
884
896
* {@link ExceptionHandlerExceptionResolver}.
897
+ * @since 4.3
885
898
*/
886
899
protected ExceptionHandlerExceptionResolver createExceptionHandlerExceptionResolver () {
887
900
return new ExceptionHandlerExceptionResolver ();
0 commit comments