[SPR-17562] AOP @RequestParam invalid, AOP RequestParamMapMethodArgumentResolver Class invalid Created: 04/Dec/18  Updated: 15/Jan/19

Status: Open
Project: Spring Framework
Component/s: Core:AOP, Web
Affects Version/s: 5.0.10
Fix Version/s: Waiting for Triage

Type: Improvement Priority: Minor
Reporter: yl-yue Assignee: Rossen Stoyanchev
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Reference URL: https://github.com/spring-projects/spring-boot/issues/15377
Days since last comment: 1 year, 30 weeks, 3 days ago
Last commented by a User: true
Last updater: Spring Issuemaster

 Description   

Problem description

Github problem notes

Additional description

expect

@RequestParam annotation Subclasses of map are supported, Not just HashMap.

implementation

As github described it.

Or you can override the default Argument Resolvers by customizing the Argument Resolvers, as in the comments below.



 Comments   
Comment by yl-yue [ 05/Dec/18 ]

Perhaps you could provide a custom Argument Resolvers override the default Argument Resolvers.

But!!!This will also involve an Argument Resolvers priority problem.

If you can control the order well, this will also be a good solution, and can meet more requirements at the same time.

 

package org.springframework.web.servlet.mvc.method.annotation;
public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
		implements BeanFactoryAware, InitializingBean {
	/**
	 * Return the list of argument resolvers to use including built-in resolvers
	 * and custom resolvers provided via {@link #setCustomArgumentResolvers}.
	 */
	private List<HandlerMethodArgumentResolver> getDefaultArgumentResolvers() {
		List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>();

		// Annotation-based argument resolution
		resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), false));
		resolvers.add(new RequestParamMapMethodArgumentResolver());
		resolvers.add(new PathVariableMethodArgumentResolver());
		resolvers.add(new PathVariableMapMethodArgumentResolver());
		resolvers.add(new MatrixVariableMethodArgumentResolver());
		resolvers.add(new MatrixVariableMapMethodArgumentResolver());
		resolvers.add(new ServletModelAttributeMethodProcessor(false));
		resolvers.add(new RequestResponseBodyMethodProcessor(getMessageConverters(), this.requestResponseBodyAdvice));
		resolvers.add(new RequestPartMethodArgumentResolver(getMessageConverters(), this.requestResponseBodyAdvice));
		resolvers.add(new RequestHeaderMethodArgumentResolver(getBeanFactory()));
		resolvers.add(new RequestHeaderMapMethodArgumentResolver());
		resolvers.add(new ServletCookieValueMethodArgumentResolver(getBeanFactory()));
		resolvers.add(new ExpressionValueMethodArgumentResolver(getBeanFactory()));
		resolvers.add(new SessionAttributeMethodArgumentResolver());
		resolvers.add(new RequestAttributeMethodArgumentResolver());

		// Type-based argument resolution
		resolvers.add(new ServletRequestMethodArgumentResolver());
		resolvers.add(new ServletResponseMethodArgumentResolver());
		resolvers.add(new HttpEntityMethodProcessor(getMessageConverters(), this.requestResponseBodyAdvice));
		resolvers.add(new RedirectAttributesMethodArgumentResolver());
		resolvers.add(new ModelMethodProcessor());
		resolvers.add(new MapMethodProcessor());
		resolvers.add(new ErrorsMethodArgumentResolver());
		resolvers.add(new SessionStatusMethodArgumentResolver());
		resolvers.add(new UriComponentsBuilderMethodArgumentResolver());

		// Custom arguments
		if (getCustomArgumentResolvers() != null) {
			resolvers.addAll(getCustomArgumentResolvers());
		}

		// Catch-all
		resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), true));
		resolvers.add(new ServletModelAttributeMethodProcessor(true));

		return resolvers;
	}
}
Comment by Rossen Stoyanchev [ 06/Dec/18 ]

Thanks for the report. I read the original ticket filed in Spring Boot, but did not understand what the request is about. Can you fill out the description field above and explain what the problem is? If you cannot edit the description, just add a new comment, but preferably fill out the description.

Comment by yl-yue [ 07/Dec/18 ]

Additional description

Comment by Spring Issuemaster [ 14/Jan/19 ]

The Spring Framework has migrated to GitHub Issues. Please visit spring-projects/spring-framework#22094 for further activity, or to subscribe to receive notifications.

Generated at Fri Aug 14 15:22:54 UTC 2020 using Jira 8.5.4#805004-sha1:0444eab799707f9ad7b248d69f858774aadfd250.