From 0ddcbce90ac37581988a8850e990d98731ff77fa Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Thu, 23 Apr 2015 11:16:20 -0400 Subject: [PATCH] MvcUriCB no longer extends UriCB Before 4.2 the MvcUriComponentsBuilder exposed only static factory methods and therefore there should be no reason for it to extend UriComponentsBuilder (design oversight). It's also highly unlikely for application code to treat MvcUriCB as UriCB since there is no need and no way to obtain an instance (constructor is protected). This change removes the base class declaration from MvcUriCB. Issue: SPR-12617 --- .../annotation/MvcUriComponentsBuilder.java | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java index ff023c0351..81b142ffbe 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java @@ -82,7 +82,7 @@ import org.springframework.web.util.UriComponentsBuilder; * @author Rossen Stoyanchev * @since 4.0 */ -public class MvcUriComponentsBuilder extends UriComponentsBuilder { +public class MvcUriComponentsBuilder { /** * Well-known name for the {@link CompositeUriComponentsContributor} object in the bean factory. @@ -122,14 +122,6 @@ public class MvcUriComponentsBuilder extends UriComponentsBuilder { this.baseUrl = baseUrl; } - /** - * Create a deep copy of the given MvcUriComponentsBuilder. - * @param other the other builder to copy from - */ - protected MvcUriComponentsBuilder(MvcUriComponentsBuilder other) { - super(other); - this.baseUrl = other.baseUrl; - } /** * Create an instance of this class with a base URL. After that calls to one @@ -457,7 +449,7 @@ public class MvcUriComponentsBuilder extends UriComponentsBuilder { }); } - protected static CompositeUriComponentsContributor getConfiguredUriComponentsContributor() { + private static CompositeUriComponentsContributor getConfiguredUriComponentsContributor() { WebApplicationContext wac = getWebApplicationContext(); if (wac == null) { return null; @@ -474,7 +466,7 @@ public class MvcUriComponentsBuilder extends UriComponentsBuilder { } } - protected static RequestMappingInfoHandlerMapping getRequestMappingInfoHandlerMapping() { + private static RequestMappingInfoHandlerMapping getRequestMappingInfoHandlerMapping() { WebApplicationContext wac = getWebApplicationContext(); Assert.notNull(wac, "Cannot lookup handler method mappings without WebApplicationContext"); try { @@ -612,11 +604,6 @@ public class MvcUriComponentsBuilder extends UriComponentsBuilder { return fromMethod(this.baseUrl, method, args); } - @Override - public Object clone() { - return new MvcUriComponentsBuilder(this); - } - private static class ControllerMethodInvocationInterceptor implements org.springframework.cglib.proxy.MethodInterceptor, MethodInterceptor {