Skip to content

Commit 7bb4ab6

Browse files
committed
Various @SInCE tags (and varargs on setInterceptors)
(cherry picked from commit 5222489)
1 parent 5ee65cd commit 7bb4ab6

File tree

4 files changed

+53
-36
lines changed

4 files changed

+53
-36
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
@@ -214,6 +214,10 @@ public void setApplicationContext(ApplicationContext applicationContext) {
214214
this.applicationContext = applicationContext;
215215
}
216216

217+
/**
218+
* Return the associated Spring {@link ApplicationContext}.
219+
* @since 4.2
220+
*/
217221
public ApplicationContext getApplicationContext() {
218222
return this.applicationContext;
219223
}
@@ -227,6 +231,10 @@ public void setServletContext(ServletContext servletContext) {
227231
this.servletContext = servletContext;
228232
}
229233

234+
/**
235+
* Return the associated {@link javax.servlet.ServletContext}.
236+
* @since 4.2
237+
*/
230238
public ServletContext getServletContext() {
231239
return this.servletContext;
232240
}
@@ -267,8 +275,9 @@ public RequestMappingHandlerMapping requestMappingHandlerMapping() {
267275
}
268276

269277
/**
270-
* Protected method for plugging in a custom sub-class of
278+
* Protected method for plugging in a custom subclass of
271279
* {@link RequestMappingHandlerMapping}.
280+
* @since 4.0
272281
*/
273282
protected RequestMappingHandlerMapping createRequestMappingHandlerMapping() {
274283
return new RequestMappingHandlerMapping();
@@ -319,6 +328,32 @@ protected PathMatchConfigurer getPathMatchConfigurer() {
319328
protected void configurePathMatch(PathMatchConfigurer configurer) {
320329
}
321330

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+
322357
/**
323358
* Return a {@link ContentNegotiationManager} instance to use to determine
324359
* requested {@linkplain MediaType media types} in a given request.
@@ -416,8 +451,7 @@ public HandlerMapping resourceHandlerMapping() {
416451
if (handlerMapping != null) {
417452
handlerMapping.setPathMatcher(mvcPathMatcher());
418453
handlerMapping.setUrlPathHelper(mvcUrlPathHelper());
419-
handlerMapping.setInterceptors(new HandlerInterceptor[] {
420-
new ResourceUrlProviderExposingInterceptor(mvcResourceUrlProvider())});
454+
handlerMapping.setInterceptors(new ResourceUrlProviderExposingInterceptor(mvcResourceUrlProvider()));
421455
handlerMapping.setCorsConfigurations(getCorsConfigurations());
422456
}
423457
else {
@@ -433,6 +467,10 @@ public HandlerMapping resourceHandlerMapping() {
433467
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
434468
}
435469

470+
/**
471+
* A {@link ResourceUrlProvider} bean for use with the MVC dispatcher.
472+
* @since 4.1
473+
*/
436474
@Bean
437475
public ResourceUrlProvider mvcResourceUrlProvider() {
438476
ResourceUrlProvider urlProvider = new ResourceUrlProvider();
@@ -507,8 +545,9 @@ public RequestMappingHandlerAdapter requestMappingHandlerAdapter() {
507545
}
508546

509547
/**
510-
* Protected method for plugging in a custom sub-class of
548+
* Protected method for plugging in a custom subclass of
511549
* {@link RequestMappingHandlerAdapter}.
550+
* @since 4.3
512551
*/
513552
protected RequestMappingHandlerAdapter createRequestMappingHandlerAdapter() {
514553
return new RequestMappingHandlerAdapter();
@@ -598,41 +637,12 @@ protected Validator getValidator() {
598637
return null;
599638
}
600639

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-
631640
/**
632641
* Provide access to the shared custom argument resolvers used by the
633642
* {@link RequestMappingHandlerAdapter} and the
634643
* {@link ExceptionHandlerExceptionResolver}. This method cannot be
635644
* overridden, use {@link #addArgumentResolvers(List)} instead.
645+
* @since 4.3
636646
*/
637647
protected final List<HandlerMethodArgumentResolver> getArgumentResolvers() {
638648
if (this.argumentResolvers == null) {
@@ -661,6 +671,7 @@ protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argument
661671
* {@link RequestMappingHandlerAdapter} and the
662672
* {@link ExceptionHandlerExceptionResolver}. This method cannot be
663673
* overridden, use {@link #addReturnValueHandlers(List)} instead.
674+
* @since 4.3
664675
*/
665676
protected final List<HandlerMethodReturnValueHandler> getReturnValueHandlers() {
666677
if (this.returnValueHandlers == null) {
@@ -769,6 +780,7 @@ else if (gsonPresent) {
769780
/**
770781
* Return an instance of {@link CompositeUriComponentsContributor} for use with
771782
* {@link org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder}.
783+
* @since 4.0
772784
*/
773785
@Bean
774786
public CompositeUriComponentsContributor mvcUriComponentsContributor() {
@@ -875,8 +887,9 @@ protected final void addDefaultHandlerExceptionResolvers(List<HandlerExceptionRe
875887
}
876888

877889
/**
878-
* Protected method for plugging in a custom sub-class of
890+
* Protected method for plugging in a custom subclass of
879891
* {@link ExceptionHandlerExceptionResolver}.
892+
* @since 4.3
880893
*/
881894
protected ExceptionHandlerExceptionResolver createExceptionHandlerExceptionResolver() {
882895
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)