【发布时间】:2015-04-19 14:09:24
【问题描述】:
我有一个前端带有 angular 的 spring boot 应用程序。
我正在使用带有 html5 模式的 ui-router,我希望 spring 在所有未知路由上呈现相同的 index.html。
// Works great, but it also overrides all the resources
@RequestMapping
public String index() {
return "index";
}
// Seems do be the same as above, but still overrides the resources
@RequestMapping("/**")
public String index() {
return "index";
}
// Works well but not for subdirectories. since it doesn't map to those
@RequestMapping("/*")
public String index() {
return "index";
}
所以我的问题是如何创建一个后备映射,但它可以让资源通过?
【问题讨论】:
-
你需要使用 HandlerInterceptor 才能做到这一点
-
tcharaf 场景适合我
标签: angularjs spring spring-mvc spring-boot