Spring Boot with AngularJS html5Mode

后端 未结 9 2306
长发绾君心
长发绾君心 2020-11-27 04:35

I start my web application with spring boot. It use a simple main class to start an embedded tomcat server:

@Configuration
@EnableAutoConfiguration
@Componen         


        
9条回答
  •  广开言路
    2020-11-27 04:40

    I just encountered the similar issue where I wanted to configure Resources and at the same time I wanted to use AngularJS Html5 mode enabled.

    In my case my static files were served from /public route so I used the following request mapping on my index action and it all works fine.

    @RequestMapping(value = {"", "/", "/{[path:(?!public).*}/**"}, method = GET)
    public String indexAction() {
        return "index";
    }
    

提交回复
热议问题