Skip to content

Commit 1caca6e

Browse files
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
1 parent f4c2714 commit 1caca6e

File tree

2 files changed

+8
-4
lines changed
  • spring-boot-project

2 files changed

+8
-4
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public BasicErrorController(ErrorAttributes errorAttributes, ErrorProperties err
8383

8484
@Override
8585
public String getErrorPath() {
86-
return this.errorProperties.getPath();
86+
return null;
8787
}
8888

8989
@RequestMapping(produces = MediaType.TEXT_HTML_VALUE)

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorController.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,23 @@
1919
import org.springframework.stereotype.Controller;
2020

2121
/**
22-
* Marker interface used to indicate that a {@link Controller @Controller} is used to
23-
* render errors. Primarily used to know the error paths that will not need to be secured.
22+
* Marker interface used to identify a {@link Controller @Controller} that should be used
23+
* to render errors.
2424
*
2525
* @author Phillip Webb
26+
* @author Scott Frederick
2627
* @since 2.0.0
2728
*/
2829
@FunctionalInterface
2930
public interface ErrorController {
3031

3132
/**
32-
* Returns the path of the error page.
33+
* The return value from this method is not used; the property `server.error.path`
34+
* must be set to override the default error page path.
3335
* @return the error path
36+
* @deprecated since 2.3.0 in favor of setting the property `server.error.path`
3437
*/
38+
@Deprecated
3539
String getErrorPath();
3640

3741
}

0 commit comments

Comments
 (0)