[英]Spring Boot Single Page Application Routing on any URL
I am trying to accomplish the following (if possible). 我正在尝试完成以下操作(如果可能)。
I have a single page application at localhost:8080
and everything currently lands on localhost:8080/
even if a user enters: localhost:8080/signIn
我在
localhost:8080
有一个单页应用程序,并且即使用户输入,当前所有内容都位于localhost:8080/
: localhost:8080/signIn
It does client side routing so that after you land on localhost:8080/
you can click a button and it takes you to localhost:8080/signIn
它执行客户端路由,以便您登陆
localhost:8080/
可以单击一个按钮,它将带您到localhost:8080/signIn
Is there a way using springboot to allow whatever the user passes in without having it redirect automatically to localhost:8080/
(all the while returning the single page - index.html)? 有没有一种方法可以使用springboot来允许用户传入的任何内容,而无需使其自动重定向到
localhost:8080/
(同时返回单个页面-index.html)?
Thanks! 谢谢!
Try this way 试试这个
@Controller
@RequestMapping("/")
public class AnythingController{
@RequestMapping(value="**",method = RequestMethod.GET)
public String getAnything(){
// your code
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.