I have the following project structure in my Spring boot app, in which I want to use Thymeleaf
projectName
-Gradle-Module1(Spring boot module)
-build
-src
-main
-resources
-templates
index.html
build.gradle
-Gradle-Module2
...
build.gradle
...
but the spring-boot cannot find my template directory and is showing warning
Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
PS: I am using @EnableAutoConfiguration
In my controller code I am doing something like:
@Controller
@EnableAutoConfiguration
public class BaseController {
@RequestMapping(value = "/")
public String index() {
return "index.html";
}
}
and index.html
file just prints hello world.
So typically it should look inside src/resources/templates/
(of same Gradle module I suppose), but somehow it is not able to find it.
When I try to access localhost:8080
I am getting below error
Error resolving template "index.html", template might not exist or might not be accessible by any of the configured Template Resolvers`
Is there anything I am missing?
Any pointers appreciated. Thanks.