From 5d0fc72eb22c1825a508c75428a509641314159c Mon Sep 17 00:00:00 2001 From: WonYong Hwang <111210881+wonyongg@users.noreply.github.com> Date: Wed, 18 Jun 2025 20:00:44 +0900 Subject: [PATCH] Document intention of toString() in HandlerMethod Document that HandlerMethod.toString() is used in log and error messages, and that the returned description should typically include the method signature of the underlying handler method for clarity and debugging. Closes gh-35055 Signed-off-by: WonYong Hwang <111210881+wonyongg@users.noreply.github.com> Co-authored-by: Sam Brannen <104798+sbrannen@users.noreply.github.com> --- .../java/org/springframework/web/method/HandlerMethod.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java b/spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java index 639bc9bca7e..746e0f3950e 100644 --- a/spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java +++ b/spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java @@ -352,6 +352,12 @@ public class HandlerMethod extends AnnotatedMethod { return (this.bean.hashCode() * 31 + super.hashCode()); } + /** + * Returns a concise description of this {@code HandlerMethod}, which is used + * in log and error messages. + *
The description should typically include the method signature of the + * underlying handler method for clarity and debugging purposes. + */ @Override public String toString() { return this.description;