Spring-boot thymeleaf loads HTML file from class path

I have a multi-module project structure, like:

- application (parent module) --- boot (web-app) ----- src/main/resources/templates/layout.html ---- todo (jar file) ----- src/main/resources/templates/home.html 

and on my controller:

 @RequestMapping(value = "/home") public String home() { return "todo/home"; } 

I get an error as shown below:

 Error resolving template "todo/home", template might not exist or might not be accessible by any of the configured Template Resolvers] 

Do I need a configuration to set up something specifically for spring to look for patterns on the way to classes?

+14
java spring spring-boot
source share
1 answer

Adding the following properties solves my problem:

 spring.thymeleaf.check-template-location=true spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.suffix=.html spring.thymeleaf.mode=LEGACYHTML5 spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.content-type=text/html spring.thymeleaf.cache=false 
+13
source share

All Articles