简体   繁体   中英

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

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

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)?

Thanks!

Try this way

@Controller
@RequestMapping("/")
public class AnythingController{

    @RequestMapping(value="**",method = RequestMethod.GET)
    public String getAnything(){
        // your code
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM