我相信这是一个简单的问题,但我找不到答案,或者至少在搜索中使用了正确的术语.
我将同时设置Angular2
和Springboot
.默认情况下,Angular
将使用localhost:8080\dashboard
和localhost:8080\dashboard\detail
这样的路径.
如果可能的话,我希望避免使用path作为哈希.documentation个州:
路由的ProvideRouter功能将LocationStrategy设置为PathLocationStrategy,使其成为默认策略.如果愿意,我们可以在 bootstrap 过程中切换到具有覆盖的HashLocationStrategy.
然后...
几乎所有的Angular 2项目都应该使用默认的HTML5样式.它生成用户更容易理解的URL.并且它保留了稍后进行服务器端渲染的选项.
问题是,当我try 访问localhost:8080\dashboard
时,Spring会寻找一些控制器映射到此路径,而它没有.
Whitelabel Error Page
There was an unexpected error (type=Not Found, status=404).
No message available
我最初的 idea 是让我所有的服务低于localhost:8080\api
,所有的静态服务低于localhost:8080\app
.但我如何告诉Spring忽略对这条路径的请求呢?
Angular2或Boot有更好的解决方案吗?