Java – Spring Boot – Proper location for html files

javaspring-boot

I am new to Spring Boot and I am trying to add a simple html page for my project
At the moment, my project's structure is the following:

enter image description here

Having read the following:
https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot

http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-developing-web-applications.html#boot-features-spring-mvc-static-content

and other answers in StackOverflow, I'd expect to see the contents of index.html when I visit http://localhost:8080/

What could I be missing?

Best Answer

First of all the correct way to serve files in Spring Boot is described in cannot find html pages with spring boot

After adding the directories required, I tried /services/login.html where "services" is the mapping for my Dispatcher servlet. So what happens here is that Spring Boot will only answer to requests sent to /services/* even if these requests are pointing to something other than a controller. I guess that this makes sense in the world of Spring Boot but when I tried in the same in a Spring MVC project (no Spring Boot) I was able to access simple html files that I had simply added into my WEB-INF directory