From 829add3aa9d533ad8bde73d8283a2f6354ce1866 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Tue, 14 Apr 2026 16:30:56 +0200 Subject: [PATCH] Update Javadoc for HttpMethod.valueOf() on main See gh-36642 See gh-36652 --- .../main/java/org/springframework/http/HttpMethod.java | 9 +++++++++ 1 file changed, 9 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 bf5843aeda7..422abf28203 100644 --- a/spring-web/src/main/java/org/springframework/http/HttpMethod.java +++ b/spring-web/src/main/java/org/springframework/http/HttpMethod.java @@ -114,6 +114,15 @@ public final class HttpMethod implements Comparable, Serializable { * Return an {@code HttpMethod} object for the given value. *

As of Spring Framework 7.1, lookups for predefined constants such as * {@link HttpMethod#GET GET} are case-insensitive. + *

If no predefined constant matches, a new {@code HttpMethod} instance is + * returned for the given value as-is. + *

For example, {@code HttpMethod.valueOf("GET")} and + * {@code HttpMethod.valueOf("get")} both resolve to {@link HttpMethod#GET}. + * Whereas, {@code HttpMethod.valueOf("FOO")} and + * {@code HttpMethod.valueOf("foo")} resolve to {@code new HttpMethod("FOO")} + * and {@code new HttpMethod("foo")}, respectively. In the latter case, the + * two resulting {@code HttpMethod} instances are not + * {@linkplain #equals(Object) equal} and do not {@linkplain #matches(String) match}. * @param method the method value as a String * @return the corresponding {@code HttpMethod} */