我们有一个Ember前端和Spring Boot后端。 当Ember在端口4200上运行独立并在8080上运行Spring Boot后端时,一切正常。但是这种情况在生产环境中有些不寻常,不仅因为CORS问题。后端的URL必须在Ember应用程序的构建时(!)已知,因为它已经集成在编译后的应用程序中。对许多项目来说这是不可能的。因此,我们希望在Spring Boot后端集成前端Ember应用程序,这通常用于例如SPA与AngularJS。 Ember应用程序(来自/ dist)因此被复制到src/main/resource/static。使用Ember应用程序调整rootURL和API.host后,效果非常好。 现在的问题是,当在浏览器中手动重新加载URL时。这样的URL现在是Ember路线。 http请求到达Spring Boot后端,它不知道路由,我们得到了404错误。如何在SpringMVC中配置emberjs路由?
SpringMVC(作为Spring Boot后端的一部分)应该如何为这样的路径回答httpRequest,以便Ember应用程序继续他们的工作并处理请求?
HTML Page request (by browser)
http://host/springBootAppContext/index.html => src/main/resource/static/index.html (ember app)
REST API request (by Ember App)
http://host/springBootAppContext/users => RESTController mapped for /users
Ember Routing (by Ember App)
http://host/springBootAppContext/user-list => ???
您不能提供正常的Spring MVC @Controller类,因为模型视图响应interpretet为用户list.html或类似不存在