Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Thymeleaf templates out of the Jar file

I have a Spring-boot application using Thymeleaf as the view engine and I want to use a folder outside the deployed Jar as the source of the Thymeleaf templates, I set the variable:

spring.thymeleaf.prefix=classpath:/templates/

The "/templates/" is next to the Jar with the HTML files but I get an exception that Thymeleaf cannot resolve the templates, I've tried many configurations like:

spring.thymeleaf.prefix=classpath:templates/
spring.thymeleaf.prefix=classpath:templates

etc, not nothing works. What am I doing wrong, it is even possible?

like image 205
user2070369 Avatar asked May 03 '16 16:05

user2070369


1 Answers

OK, looks like the way to do it is setting the value using the file url like this:

spring.thymeleaf.prefix=file:./templates/

It Works now.

like image 132
user2070369 Avatar answered Sep 20 '22 16:09

user2070369