Search code examples
springspring-bootspring-mvcthymeleaf

Cannot locate any file inside templates folder from browser


I've made some thymeleaf templates and want to use it with Spring Boot (on Tomcat) and the only location inside a project where I can find a .html file from browser is src/main/resources/static. When I place a file there, I can access it with contextRoot/filename.html. But when I place it inside src/main/resources/templates folder, I cannot access it with neither of this: root/filename.html, root/resources/filename.html. What's the problem here?


Solution

  • Problem was that I didn't have Spring Boot Thymeleaf Starter dependency in the POM. I had plain Thymeleaf dependency not intended for Spring Boot and using it needed more configuration unlike the first one that works out of the box.