diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestKey.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestKey.java index 7e45971829..16158fe8d2 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestKey.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestKey.java @@ -26,6 +26,7 @@ import java.util.Set; import javax.servlet.http.HttpServletRequest; import org.springframework.util.PathMatcher; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.method.condition.RequestCondition; @@ -92,7 +93,7 @@ public final class RequestKey { } Set result = new LinkedHashSet(patterns.size()); for (String pattern : patterns) { - if (!pattern.startsWith("/")) { + if (StringUtils.hasLength(pattern) && !pattern.startsWith("/")) { pattern = "/" + pattern; } result.add(pattern); @@ -169,9 +170,9 @@ public final class RequestKey { *