我为你提供了一个解决方案,你可以添加一个ViewController以将请求从Spring引导转发到Angular。
import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;@Controllerpublic class ViewController {@RequestMapping({ "/bikes", "/milages", "/gallery", "/tracks", "/tracks/{id:\w+}", "/location", "/about", "/tests","/tests/new","/tests/**","/questions","/answers" }) public String index() { return "forward:/index.html"; }}
在这里,我重定向了我所有的
angular2(“ / bikes”,“ / milages”,“ / gallery”,“ / tracks”,“ / tracks / {id: w +}”,“ / location”,“ / about”, “ / tests”,“ / tests / new”,“ / tests / **”,“ / questions”,“ / answers”)到我的SPA中。你可以对自己的预言进行相同的 *** 作,也可以重定向404错误页面进入索引页面,作为下一步。请享用!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)