问题可能是您
/rest在
web.xml和中都重复了前缀
@RequestMapping。它应该在一个或两个中的一个中,但不能同时在两个中,例如
<url-pattern>/rest</url-pattern>
和
@RequestMapping(value = "/testService")
在其上进行
@RequestMapping操作的路径是servlet部分之后的路径的一部分,您
web.xml将servlet部分定义为
/path,因此
@RequestMapping与剩下的任何内容(即)匹配
/testService。
在当前形式下,您
@RequestMapping实际上与匹配
{contextPath}/rest/rest/testService。


