@RequestMapping(value = "/owners/{ownerId}/pets/{petId}", method = RequestMethod.GET) public void findPet(@MatrixVariable Map<String, String> matrixVars, @MatrixVariable(pathVar = "ownerId") Map<String, String> petMatrixVars) { System.out.println(matrixVars); System.out.println(petMatrixVars); }
上面代码是spring文档中的例子,浏览器中输入:http://localhost:8080/owners/44/pets/55;q=22,33;s=23时,控制台输出:
{q=[22, 33], s=[23]} {q=[22, 33], s=[23]}
但是当输入http://localhost:8080/owners/42;q=11;r=12/pets/55;q=22,33;s=23则findPet方法没有执行,难道spring文档有错误?还是少了什么配置?