From 3bf184f9f129b3e68f283260e5868c1d2654707c Mon Sep 17 00:00:00 2001 From: angry-2k Date: Tue, 14 Apr 2026 18:59:03 +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. Closes gh-36642 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 608d7d535a1c..348692d55d0e 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 static HttpMethod[] values() { /** * 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} */