Java 使@modeldattribute注释接受表单数据而不是x-www-form-urlencoded

Java 使@modeldattribute注释接受表单数据而不是x-www-form-urlencoded,java,spring,spring-mvc,modelattribute,Java,Spring,Spring Mvc,Modelattribute,我在项目中使用SpringWebMVC,在控制器操作中使用@ModelAttribute注释将表单数据绑定到模型。如果我以x-www-form-urlencoded格式发送数据,ModelAttribute可以绑定数据。但如果我以简单格式数据发送数据,则它不绑定 我使用POSTMAN Rest客户端发送请求,下面是我请求的格式- POST /register-school HTTP/1.1 Host: localhost:8080 Accept: application/json Cache-C

我在项目中使用SpringWebMVC,在控制器操作中使用@ModelAttribute注释将表单数据绑定到模型。如果我以x-www-form-urlencoded格式发送数据,ModelAttribute可以绑定数据。但如果我以简单格式数据发送数据,则它不绑定

我使用POSTMAN Rest客户端发送请求,下面是我请求的格式-

POST /register-school HTTP/1.1
Host: localhost:8080
Accept: application/json
Cache-Control: no-cache

----WebKitFormBoundaryE19zNvXGzXaLvS5C
Content-Disposition: form-data; name="email"

testing@test.com
----WebKitFormBoundaryE19zNvXGzXaLvS5C
对于上述请求,我的ModelAttribute未将数据绑定到对象

但是如果我用x-www-form-urlencoded发送请求,它就会工作

POST /register-school HTTP/1.1
Host: localhost:8080
Accept: application/json
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded

email=testing%40test.com

是否有任何方法使ModelAttribute也能处理表单数据?

请提供一个表单数据失败的可复制示例。我正在与postMan一起测试我的应用程序,这里是表单数据请求预览-POST/register school HTTP/1.1主机:localhost:8080接受:应用程序/json缓存控制:无缓存----WebKitFormBoundaryE19zNvXGzXaLvS5C内容配置:表单数据;name=“var2”值1---WebKitFormBoundaryE19zNvXGzXaLvS5C