Skip to content

Commit ed14ae6

Browse files
committed
Consistent deprecation of outdated MVC infrastructure classes
Issue: SPR-14128
1 parent 4ea4257 commit ed14ae6

19 files changed

+68
-36
lines changed

spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvocationException.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
* @author Juergen Hoeller
2727
* @since 2.5.6
2828
* @see HandlerMethodInvoker#invokeHandlerMethod
29+
* @deprecated as of 4.3, in favor of the {@code HandlerMethod}-based MVC infrastructure
2930
*/
31+
@Deprecated
3032
@SuppressWarnings("serial")
3133
public class HandlerMethodInvocationException extends NestedRuntimeException {
3234

spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@
9494
* @author Arjen Poutsma
9595
* @since 2.5.2
9696
* @see #invokeHandlerMethod
97+
* @deprecated as of 4.3, in favor of the {@code HandlerMethod}-based MVC infrastructure
9798
*/
99+
@Deprecated
98100
public class HandlerMethodInvoker {
99101

100102
private static final String MODEL_KEY_PREFIX_STALE = SessionAttributeStore.class.getName() + ".STALE.";

spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodResolver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
* @see org.springframework.web.bind.annotation.InitBinder
4949
* @see org.springframework.web.bind.annotation.ModelAttribute
5050
* @see org.springframework.web.bind.annotation.SessionAttributes
51+
* @deprecated as of 4.3, in favor of the {@code HandlerMethod}-based MVC infrastructure
5152
*/
53+
@Deprecated
5254
public class HandlerMethodResolver {
5355

5456
private final Set<Method> handlerMethods = new LinkedHashSet<Method>();

spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@
7676
import org.springframework.web.bind.annotation.RequestMethod;
7777
import org.springframework.web.bind.annotation.RequestParam;
7878
import org.springframework.web.bind.annotation.SessionAttributes;
79-
import org.springframework.web.bind.annotation.support.HandlerMethodInvoker;
80-
import org.springframework.web.bind.annotation.support.HandlerMethodResolver;
8179
import org.springframework.web.bind.support.DefaultSessionAttributeStore;
8280
import org.springframework.web.bind.support.SessionAttributeStore;
8381
import org.springframework.web.bind.support.WebArgumentResolver;
@@ -434,9 +432,10 @@ protected PortletRequestDataBinder createBinder(PortletRequest request, Object t
434432

435433

436434
/**
437-
* Portlet-specific subclass of {@link HandlerMethodResolver}.
435+
* Portlet-specific subclass of {@code HandlerMethodResolver}.
438436
*/
439-
private static class PortletHandlerMethodResolver extends HandlerMethodResolver {
437+
@SuppressWarnings("deprecation")
438+
private static class PortletHandlerMethodResolver extends org.springframework.web.bind.annotation.support.HandlerMethodResolver {
440439

441440
private final Map<Method, RequestMappingInfo> mappings = new HashMap<Method, RequestMappingInfo>();
442441

@@ -545,11 +544,12 @@ else if (EventRequest.class.isAssignableFrom(argType) || EventResponse.class.isA
545544

546545

547546
/**
548-
* Portlet-specific subclass of {@link HandlerMethodInvoker}.
547+
* Portlet-specific subclass of {@code HandlerMethodInvoker}.
549548
*/
550-
private class PortletHandlerMethodInvoker extends HandlerMethodInvoker {
549+
@SuppressWarnings("deprecation")
550+
private class PortletHandlerMethodInvoker extends org.springframework.web.bind.annotation.support.HandlerMethodInvoker {
551551

552-
public PortletHandlerMethodInvoker(HandlerMethodResolver resolver) {
552+
public PortletHandlerMethodInvoker(org.springframework.web.bind.annotation.support.HandlerMethodResolver resolver) {
553553
super(resolver, webBindingInitializer, sessionAttributeStore,
554554
parameterNameDiscoverer, customArgumentResolvers, null);
555555
}

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@
9696
import org.springframework.web.bind.annotation.ResponseBody;
9797
import org.springframework.web.bind.annotation.ResponseStatus;
9898
import org.springframework.web.bind.annotation.SessionAttributes;
99-
import org.springframework.web.bind.annotation.support.HandlerMethodInvoker;
100-
import org.springframework.web.bind.annotation.support.HandlerMethodResolver;
10199
import org.springframework.web.bind.support.DefaultSessionAttributeStore;
102100
import org.springframework.web.bind.support.SessionAttributeStore;
103101
import org.springframework.web.bind.support.WebArgumentResolver;
@@ -110,9 +108,6 @@
110108
import org.springframework.web.servlet.HandlerMapping;
111109
import org.springframework.web.servlet.ModelAndView;
112110
import org.springframework.web.servlet.View;
113-
import org.springframework.web.servlet.mvc.multiaction.InternalPathMethodNameResolver;
114-
import org.springframework.web.servlet.mvc.multiaction.MethodNameResolver;
115-
import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException;
116111
import org.springframework.web.servlet.support.RequestContextUtils;
117112
import org.springframework.web.servlet.support.WebContentGenerator;
118113
import org.springframework.web.util.UrlPathHelper;
@@ -164,7 +159,8 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
164159

165160
private PathMatcher pathMatcher = new AntPathMatcher();
166161

167-
private MethodNameResolver methodNameResolver = new InternalPathMethodNameResolver();
162+
private org.springframework.web.servlet.mvc.multiaction.MethodNameResolver methodNameResolver =
163+
new org.springframework.web.servlet.mvc.multiaction.InternalPathMethodNameResolver();
168164

169165
private WebBindingInitializer webBindingInitializer;
170166

@@ -255,7 +251,7 @@ public void setPathMatcher(PathMatcher pathMatcher) {
255251
* <p>Will only kick in when the handler method cannot be resolved uniquely
256252
* through the annotation metadata already.
257253
*/
258-
public void setMethodNameResolver(MethodNameResolver methodNameResolver) {
254+
public void setMethodNameResolver(org.springframework.web.servlet.mvc.multiaction.MethodNameResolver methodNameResolver) {
259255
this.methodNameResolver = methodNameResolver;
260256
}
261257

@@ -524,9 +520,10 @@ protected HttpOutputMessage createHttpOutputMessage(HttpServletResponse servletR
524520

525521

526522
/**
527-
* Servlet-specific subclass of {@link HandlerMethodResolver}.
523+
* Servlet-specific subclass of {@code HandlerMethodResolver}.
528524
*/
529-
private class ServletHandlerMethodResolver extends HandlerMethodResolver {
525+
@SuppressWarnings("deprecation")
526+
private class ServletHandlerMethodResolver extends org.springframework.web.bind.annotation.support.HandlerMethodResolver {
530527

531528
private final Map<Method, RequestMappingInfo> mappings = new HashMap<Method, RequestMappingInfo>();
532529

@@ -674,7 +671,8 @@ else if (useTypeLevelMapping(request)) {
674671
if (!allowedMethods.isEmpty()) {
675672
throw new HttpRequestMethodNotSupportedException(request.getMethod(), StringUtils.toStringArray(allowedMethods));
676673
}
677-
throw new NoSuchRequestHandlingMethodException(lookupPath, request.getMethod(), request.getParameterMap());
674+
throw new org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException(
675+
lookupPath, request.getMethod(), request.getParameterMap());
678676
}
679677
}
680678

@@ -768,13 +766,14 @@ private void extractHandlerMethodUriTemplates(String mappedPattern, String looku
768766

769767

770768
/**
771-
* Servlet-specific subclass of {@link HandlerMethodInvoker}.
769+
* Servlet-specific subclass of {@code HandlerMethodInvoker}.
772770
*/
773-
private class ServletHandlerMethodInvoker extends HandlerMethodInvoker {
771+
@SuppressWarnings("deprecation")
772+
private class ServletHandlerMethodInvoker extends org.springframework.web.bind.annotation.support.HandlerMethodInvoker {
774773

775774
private boolean responseArgumentUsed = false;
776775

777-
private ServletHandlerMethodInvoker(HandlerMethodResolver resolver) {
776+
private ServletHandlerMethodInvoker(org.springframework.web.bind.annotation.support.HandlerMethodResolver resolver) {
778777
super(resolver, webBindingInitializer, sessionAttributeStore, parameterNameDiscoverer,
779778
customArgumentResolvers, messageConverters);
780779
}

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import org.springframework.web.context.request.WebRequest;
4747
import org.springframework.web.multipart.support.MissingServletRequestPartException;
4848
import org.springframework.web.servlet.NoHandlerFoundException;
49-
import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException;
5049
import org.springframework.web.util.WebUtils;
5150

5251
/**
@@ -99,8 +98,9 @@ public abstract class ResponseEntityExceptionHandler {
9998
* @param ex the target exception
10099
* @param request the current request
101100
*/
101+
@SuppressWarnings("deprecation")
102102
@ExceptionHandler({
103-
NoSuchRequestHandlingMethodException.class,
103+
org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException.class,
104104
HttpRequestMethodNotSupportedException.class,
105105
HttpMediaTypeNotSupportedException.class,
106106
HttpMediaTypeNotAcceptableException.class,
@@ -118,9 +118,9 @@ public abstract class ResponseEntityExceptionHandler {
118118
})
119119
public final ResponseEntity<Object> handleException(Exception ex, WebRequest request) {
120120
HttpHeaders headers = new HttpHeaders();
121-
if (ex instanceof NoSuchRequestHandlingMethodException) {
121+
if (ex instanceof org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException) {
122122
HttpStatus status = HttpStatus.NOT_FOUND;
123-
return handleNoSuchRequestHandlingMethod((NoSuchRequestHandlingMethodException) ex, headers, status, request);
123+
return handleNoSuchRequestHandlingMethod((org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException) ex, headers, status, request);
124124
}
125125
else if (ex instanceof HttpRequestMethodNotSupportedException) {
126126
HttpStatus status = HttpStatus.METHOD_NOT_ALLOWED;
@@ -213,8 +213,10 @@ protected ResponseEntity<Object> handleExceptionInternal(Exception ex, Object bo
213213
* @param status the selected response status
214214
* @param request the current request
215215
* @return a {@code ResponseEntity} instance
216+
* @deprecated as of 4.3, along with {@link org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException}
216217
*/
217-
protected ResponseEntity<Object> handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException ex,
218+
@Deprecated
219+
protected ResponseEntity<Object> handleNoSuchRequestHandlingMethod(org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException ex,
218220
HttpHeaders headers, HttpStatus status, WebRequest request) {
219221

220222
pageNotFoundLogger.warn(ex.getMessage());

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/AbstractUrlMethodNameResolver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
*
3535
* @author Juergen Hoeller
3636
* @since 14.01.2004
37+
* @deprecated as of 4.3, in favor of annotation-driven handler methods
3738
*/
39+
@Deprecated
3840
public abstract class AbstractUrlMethodNameResolver implements MethodNameResolver {
3941

4042
/** Logger available to subclasses */

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/InternalPathMethodNameResolver.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
*
3636
* @author Rod Johnson
3737
* @author Juergen Hoeller
38-
*/
38+
* @deprecated as of 4.3, in favor of annotation-driven handler methods
39+
*/
40+
@Deprecated
3941
public class InternalPathMethodNameResolver extends AbstractUrlMethodNameResolver {
4042

4143
private String prefix = "";

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MethodNameResolver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
*
2929
* @author Rod Johnson
3030
* @see MultiActionController#setMethodNameResolver
31+
* @deprecated as of 4.3, in favor of annotation-driven handler methods
3132
*/
33+
@Deprecated
3234
public interface MethodNameResolver {
3335

3436
/**

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@
127127
* @see ParameterMethodNameResolver
128128
* @see org.springframework.web.servlet.mvc.LastModified#getLastModified
129129
* @see org.springframework.web.bind.ServletRequestDataBinder
130+
* @deprecated as of 4.3, in favor of annotation-driven handler methods
130131
*/
132+
@Deprecated
131133
public class MultiActionController extends AbstractController implements LastModified {
132134

133135
/** Suffix for last-modified methods */

0 commit comments

Comments
 (0)