Anton Anton - 1 year ago 49
Java Question

Spring Boot - how to serve one static html file for multiple routes in specified root

I need to serve static

for all routes in specified root
(as example '/main/\**')
. I've tried to annotate controller method with
, but it works only for
route, not for '
, etc...

So, how i can do this in spring boot?

Answer Source

I found this solution:


// Controller for index.html
public class IndexController {

    @RequestMapping({"/login", "/main/**"})
    public String index() {
        return "index";