I have a Spring Boot app setup as a REST api. I now also want to be able to serve simple HTML pages to the client, without the use on any template engine like Thymeleaf. I want access to the HTML pages to fall under the same security constraints setup by Spring Security with the use of WebSecurityConfigurerAdapter
, already present in my app.
What I've tried is having a Controller
:
@Controller
public class HtmlPageController {
@RequestMapping(value = "/some/path/test", method = RequestMethod.GET)
public String getTestPage() {
return "test.html";
}
}
and placing the test.html
file in /resources/test.html
or /webapp/WEB-INF/test.html
.
Every time I try to access the page at localhost:8080/some/path/test
a 404
is returned.
How do I make this work?