地址1:http://localhost:8762/hello地址2:http://localhost:8762///hello訪問1 和訪問2結(jié)果一樣。期望的是訪問2返回404.相關(guān)代碼:@RestControllerpublic class HelloController { @GetMapping("hello")
public String index() { return "Hello World";
}
}@SpringBootApplicationpublic class EurekaClientApplication extends WebMvcConfigurationSupport {
public static void main(String[] args) { SpringApplication.run(EurekaClientApplication.class, args);
} @Override
protected void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseSuffixPatternMatch(false)
.setUseTrailingSlashMatch(false);
}
}
關(guān)于spring boot url路徑匹配斜杠“/”問題?
函數(shù)式編程
2018-08-10 16:00:27