在springMvc web項目中restful風格的api路徑中有小數點會被過濾後臺拿不到最後一個小數點的問題,
有兩種解決方案:
1:在api路徑中加入:.+
@RequestMapping("/findByIp/{ip:.+}")
public Object test(@PathVariable String ip) {
System.out.println(ip);
return "";
}
但這種方式在web服務中感覺太過於雞肋
所以在springMvc.xml中配置mvc標籤
2.<mvc:path-matching registered-suffixes-only="true"/>
<mvc:annotation-driven >
<mvc:path-matching registered-suffixes-only="true"/>
</mvc:annotation-driven>