MapMethodProcessor supportsParameter is more specific
Closes gh-33160
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.bind.support.WebDataBinderFactory;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
@@ -42,7 +43,9 @@ public class MapMethodProcessor implements HandlerMethodArgumentResolver, Handle
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
return (Map.class.isAssignableFrom(parameter.getParameterType()) &&
|
||||
// We don't support any type of Map
|
||||
Class<?> type = parameter.getParameterType();
|
||||
return ((type.isAssignableFrom(Map.class) || ModelMap.class.isAssignableFrom(type)) &&
|
||||
parameter.getParameterAnnotations().length == 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user