Skip to content

Commit 5222489

Browse files
committed
Various @SInCE tags (and varargs on setInterceptors)
(cherry picked from commit aac0e63)
1 parent 27f830f commit 5222489

File tree

4 files changed

+54
-37
lines changed

4 files changed

+54
-37
lines changed

spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ protected UriComponentsBuilder() {
124124
/**
125125
* Create a deep copy of the given UriComponentsBuilder.
126126
* @param other the other builder to copy from
127+
* @since 4.1.3
127128
*/
128129
protected UriComponentsBuilder(UriComponentsBuilder other) {
129130
this.scheme = other.scheme;
@@ -603,6 +604,7 @@ public UriComponentsBuilder queryParam(String name, Object... values) {
603604
* Add the given query parameters.
604605
* @param params the params
605606
* @return this UriComponentsBuilder
607+
* @since 4.0
606608
*/
607609
public UriComponentsBuilder queryParams(MultiValueMap<String, String> params) {
608610
if (params != null) {
@@ -632,6 +634,7 @@ public UriComponentsBuilder replaceQueryParam(String name, Object... values) {
632634
* Set the query parameter values overriding all existing query values.
633635
* @param params the query parameter name
634636
* @return this UriComponentsBuilder
637+
* @since 4.2
635638
*/
636639
public UriComponentsBuilder replaceQueryParams(MultiValueMap<String, String> params) {
637640
this.queryParams.clear();

spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java

Lines changed: 48 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ public void setApplicationContext(ApplicationContext applicationContext) {
217217
this.applicationContext = applicationContext;
218218
}
219219

220+
/**
221+
* Return the associated Spring {@link ApplicationContext}.
222+
* @since 4.2
223+
*/
220224
public ApplicationContext getApplicationContext() {
221225
return this.applicationContext;
222226
}
@@ -230,6 +234,10 @@ public void setServletContext(ServletContext servletContext) {
230234
this.servletContext = servletContext;
231235
}
232236

237+
/**
238+
* Return the associated {@link javax.servlet.ServletContext}.
239+
* @since 4.2
240+
*/
233241
public ServletContext getServletContext() {
234242
return this.servletContext;
235243
}
@@ -270,8 +278,9 @@ public RequestMappingHandlerMapping requestMappingHandlerMapping() {
270278
}
271279

272280
/**
273-
* Protected method for plugging in a custom sub-class of
281+
* Protected method for plugging in a custom subclass of
274282
* {@link RequestMappingHandlerMapping}.
283+
* @since 4.0
275284
*/
276285
protected RequestMappingHandlerMapping createRequestMappingHandlerMapping() {
277286
return new RequestMappingHandlerMapping();
@@ -322,6 +331,32 @@ protected PathMatchConfigurer getPathMatchConfigurer() {
322331
protected void configurePathMatch(PathMatchConfigurer configurer) {
323332
}
324333

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+
325360
/**
326361
* Return a {@link ContentNegotiationManager} instance to use to determine
327362
* requested {@linkplain MediaType media types} in a given request.
@@ -419,8 +454,7 @@ public HandlerMapping resourceHandlerMapping() {
419454
if (handlerMapping != null) {
420455
handlerMapping.setPathMatcher(mvcPathMatcher());
421456
handlerMapping.setUrlPathHelper(mvcUrlPathHelper());
422-
handlerMapping.setInterceptors(new HandlerInterceptor[] {
423-
new ResourceUrlProviderExposingInterceptor(mvcResourceUrlProvider())});
457+
handlerMapping.setInterceptors(new ResourceUrlProviderExposingInterceptor(mvcResourceUrlProvider()));
424458
handlerMapping.setCorsConfigurations(getCorsConfigurations());
425459
}
426460
else {
@@ -436,6 +470,10 @@ public HandlerMapping resourceHandlerMapping() {
436470
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
437471
}
438472

473+
/**
474+
* A {@link ResourceUrlProvider} bean for use with the MVC dispatcher.
475+
* @since 4.1
476+
*/
439477
@Bean
440478
public ResourceUrlProvider mvcResourceUrlProvider() {
441479
ResourceUrlProvider urlProvider = new ResourceUrlProvider();
@@ -512,8 +550,9 @@ public RequestMappingHandlerAdapter requestMappingHandlerAdapter() {
512550
}
513551

514552
/**
515-
* Protected method for plugging in a custom sub-class of
553+
* Protected method for plugging in a custom subclass of
516554
* {@link RequestMappingHandlerAdapter}.
555+
* @since 4.3
517556
*/
518557
protected RequestMappingHandlerAdapter createRequestMappingHandlerAdapter() {
519558
return new RequestMappingHandlerAdapter();
@@ -603,41 +642,12 @@ protected Validator getValidator() {
603642
return null;
604643
}
605644

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-
636645
/**
637646
* Provide access to the shared custom argument resolvers used by the
638647
* {@link RequestMappingHandlerAdapter} and the
639648
* {@link ExceptionHandlerExceptionResolver}. This method cannot be
640649
* overridden, use {@link #addArgumentResolvers(List)} instead.
650+
* @since 4.3
641651
*/
642652
protected final List<HandlerMethodArgumentResolver> getArgumentResolvers() {
643653
if (this.argumentResolvers == null) {
@@ -666,6 +676,7 @@ protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argument
666676
* {@link RequestMappingHandlerAdapter} and the
667677
* {@link ExceptionHandlerExceptionResolver}. This method cannot be
668678
* overridden, use {@link #addReturnValueHandlers(List)} instead.
679+
* @since 4.3
669680
*/
670681
protected final List<HandlerMethodReturnValueHandler> getReturnValueHandlers() {
671682
if (this.returnValueHandlers == null) {
@@ -774,6 +785,7 @@ else if (gsonPresent) {
774785
/**
775786
* Return an instance of {@link CompositeUriComponentsContributor} for use with
776787
* {@link org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder}.
788+
* @since 4.0
777789
*/
778790
@Bean
779791
public CompositeUriComponentsContributor mvcUriComponentsContributor() {
@@ -880,8 +892,9 @@ protected final void addDefaultHandlerExceptionResolvers(List<HandlerExceptionRe
880892
}
881893

882894
/**
883-
* Protected method for plugging in a custom sub-class of
895+
* Protected method for plugging in a custom subclass of
884896
* {@link ExceptionHandlerExceptionResolver}.
897+
* @since 4.3
885898
*/
886899
protected ExceptionHandlerExceptionResolver createExceptionHandlerExceptionResolver() {
887900
return new ExceptionHandlerExceptionResolver();

spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ public interface WebMvcConfigurer {
123123
* Configure view resolvers to translate String-based view names returned from
124124
* controllers into concrete {@link org.springframework.web.servlet.View}
125125
* implementations to perform rendering with.
126+
* @since 4.1
126127
*/
127128
void configureViewResolvers(ViewResolverRegistry registry);
128129

spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -197,7 +197,7 @@ public PathMatcher getPathMatcher() {
197197
* @see org.springframework.web.servlet.HandlerInterceptor
198198
* @see org.springframework.web.context.request.WebRequestInterceptor
199199
*/
200-
public void setInterceptors(Object[] interceptors) {
200+
public void setInterceptors(Object... interceptors) {
201201
this.interceptors.addAll(Arrays.asList(interceptors));
202202
}
203203

0 commit comments

Comments
 (0)