我有一个看起来像这样的 Controller
@RequestMapping(value = "/start/{params}", method = GET, produces = { APPLICATION_JSON_VALUE, APPLICATION_XML_VALUE })
String doStart(@PathVariable("params") Map<String,String> startParams)
如何从 url 发送 startParams
?
我所有的尝试都以:
结束IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Map]: no matching editors or conversion strategy found
也不能发送空的like
theurl/start/
它给了
dec 18, 2015 10:56:07 FM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI
是否有可能不发送任何参数,或者我需要一个单独的方法吗?:
最佳答案
您必须使用 @MatrixVariable
而不是 @PathVariable
。
关于java - url的@PathVariable Map语法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34352870/