[問題] 關於Spring trailing slash問題
Spring default是enable Trailing Slash的行為
我在我的configure有註冊RequestMappingHandlerMapping這個bean
並且取消TrailingSlashMatch的使用,如下:
@Bean
public RequestMappingHandlerMapping equestMappingHandlerMapping() {
RequestMappingHandlerMapping rmhm = new RequestMappingHandlerM
ap
rmhm.setUseSuffixPatternMatch(false);
rmhm.setUseTrailingSlashMatch(false
);
return rmhm;
}
但是很奇怪的,
我的controller有一個method @RequestMapping("/service"),
URL打上/service/還是可以...似乎上面那段的設定無效
我的Spring MVC dependency version是5.0.0.RELEASE
不知有沒有人也遇到這狀況?
感謝各位!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.135.236.53
※ 文章網址: https://www.ptt.cc/bbs/java/M.1511192380.A.AC5.html
※ 編輯: tony21177 (220.135.236.53), 11/20/2017 23:41:34
※ 編輯: tony21177 (220.135.236.53), 11/21/2017 08:16:34
→
11/21 08:33,
7年前
, 1F
11/21 08:33, 1F
→
11/21 08:33,
7年前
, 2F
11/21 08:33, 2F
※ 編輯: tony21177 (42.73.148.153), 11/21/2017 11:39:05
→
11/21 11:40,
7年前
, 3F
11/21 11:40, 3F
→
11/21 11:41,
7年前
, 4F
11/21 11:41, 4F
→
11/21 11:41,
7年前
, 5F
11/21 11:41, 5F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
java 近期熱門文章
PTT數位生活區 即時熱門文章