Spring mvc Spring resttemplate返回400错误请求

Spring mvc Spring resttemplate返回400错误请求,spring-mvc,resttemplate,Spring Mvc,Resttemplate,我的邮递员请求中有一个空的主体,用于post请求,效果很好 然而,当我尝试对resttemplate执行相同操作时,它总是返回400个错误请求 resttemplate.exchange(url, HttpMethod.POST, null, String.class) 我知道端点会返回json 当resttemplate最终执行时,它具有正确的url,并且将内容长度设置为size=1。不确定这是否是问题所在。也发布您的终结点。如何接收requestbody.post您的端点。如何接收请求体。

我的邮递员请求中有一个空的主体,用于post请求,效果很好

然而,当我尝试对resttemplate执行相同操作时,它总是返回400个错误请求

resttemplate.exchange(url, HttpMethod.POST, null, String.class)
我知道端点会返回json


当resttemplate最终执行时,它具有正确的url,并且将内容长度设置为size=1。不确定这是否是问题所在。

也发布您的终结点。如何接收requestbody.post您的端点。如何接收请求体。