From 1caca6e3d0eab2ab2af160fcf66cd9354f28323e Mon Sep 17 00:00:00 2001 From: Scott Frederick Date: Fri, 10 Apr 2020 12:37:19 -0500 Subject: [PATCH] Deprecate unused ErrorController interface method This commit marks as deprecated an interface method that is no longer used, and changes all internal implementations to return `null` to make the fact that the return value is not used more obvious. Fixes gh-19844 --- .../web/servlet/error/BasicErrorController.java | 2 +- .../boot/web/servlet/error/ErrorController.java | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java index 2ddedb988c..d8a9cf4186 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java @@ -83,7 +83,7 @@ public class BasicErrorController extends AbstractErrorController { @Override public String getErrorPath() { - return this.errorProperties.getPath(); + return null; } @RequestMapping(produces = MediaType.TEXT_HTML_VALUE) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorController.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorController.java index 695be76f14..fd6fc38fe9 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorController.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorController.java @@ -19,19 +19,23 @@ package org.springframework.boot.web.servlet.error; import org.springframework.stereotype.Controller; /** - * Marker interface used to indicate that a {@link Controller @Controller} is used to - * render errors. Primarily used to know the error paths that will not need to be secured. + * Marker interface used to identify a {@link Controller @Controller} that should be used + * to render errors. * * @author Phillip Webb + * @author Scott Frederick * @since 2.0.0 */ @FunctionalInterface public interface ErrorController { /** - * Returns the path of the error page. + * The return value from this method is not used; the property `server.error.path` + * must be set to override the default error page path. * @return the error path + * @deprecated since 2.3.0 in favor of setting the property `server.error.path` */ + @Deprecated String getErrorPath(); }