1. 程式人生 > >spring boot之spring mvc常用配置--路徑匹配引數設定(7)

spring boot之spring mvc常用配置--路徑匹配引數設定(7)

路徑匹配引數設定
在spring mvc中,路徑引數帶".","."後面的值將會忽略。
http://localhost:8080/index.xx實際訪問的路徑是http://localhost:8080/index,注意的是
博主測試基於@Controller這種情況是生效的。基於viewController情況未能實現。

1.通過重寫configurePathMatch方法可以不忽略"."後面的引數。

//不忽略"."後面的引數。
	@Override
	public void configurePathMatch(PathMatchConfigurer configurer) {
		configurer.setUseSuffixPatternMatch(false);
	}
	

設定前後對比: