From df828458fa08d250f71a28e6f5998b9f9631fb28 Mon Sep 17 00:00:00 2001 From: "angry2.k" <151515237+angry-2k@users.noreply.github.com> Date: Tue, 14 Apr 2026 23:15:43 +0900 Subject: [PATCH] Clarify semantics of HttpMethod.valueOf() HttpMethod.valueOf() performs a case-sensitive lookup of predefined HttpMethod constants. For example, valueOf("GET") resolves to HttpMethod.GET, whereas valueOf("get") results in a newly created HttpMethod instance. Update the Javadoc to explicitly document this behavior. See gh-36642 Closes gh-36652 Signed-off-by: angry-2k --- .../src/main/java/org/springframework/http/HttpMethod.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spring-web/src/main/java/org/springframework/http/HttpMethod.java b/spring-web/src/main/java/org/springframework/http/HttpMethod.java index 608d7d535a1..348692d55d0 100644 --- a/spring-web/src/main/java/org/springframework/http/HttpMethod.java +++ b/spring-web/src/main/java/org/springframework/http/HttpMethod.java @@ -110,6 +110,10 @@ public final class HttpMethod implements Comparable, Serializable { /** * Return an {@code HttpMethod} object for the given value. + *

Note that this lookup is case-sensitive. For predefined constants, + * the method value must be provided in uppercase (e.g., {@code "GET"}, + * {@code "POST"}). If no predefined constant matches, a new + * {@code HttpMethod} instance is returned for the given value as-is. * @param method the method value as a String * @return the corresponding {@code HttpMethod} */