Handling of '+' in RequestParameter change

2019-08-30 04:50发布

问题:

I have an MVC endpoint that takes a string parameter:

@RequestMapping(value = "/do-something")
@ResponseBody
public String doSomething(@RequestParam("token") String token) { ... }

When the method is called with a token containing a plus sign, e.g.:

http://localhost/do-something?token=a+b

I have verified through careful testing, that in Spring MVC 4.3.10, the value received in the token variable is a+b, but in Spring MVC 5.1.7, the value is a b.

How can I configure 5.x to preserve the old behaviour from 4.3.10 for this particular situation?

标签: spring-mvc