Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring and Thymeleaf: Template mode "HTML" has not been configured

I'm trying to figure out the spring pet clinic project : https://github.com/spring-projects/spring-petclinic

Trying to make my own basic spring project, want to use thymeleaf and I don't know what is going on because I'm constantly getting error "Template mode "HTML" has not been configured".

I've been trying to learn this by analysing the pet clinic project, then I started lurking through the tutorial: http://www.thymeleaf.org/doc/tutorials/3.0/thymeleafspring.html and there is this info about Engines and Resolvers which are not present in pet clinic project.

My question: what the hell is going on here and what steps do I need to run thymeleaf in empty spring project?

like image 766
asdfgh Avatar asked Nov 21 '16 21:11

asdfgh


1 Answers

So I've tried everything I could and it turns out that probably the cause for that was that the default thymeleaf parser is for HTML5 (this means that property spring.thymeleaf.mode in application.properties file equals HTML5).

Default application.properties values: http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

The line "spring.thymeleaf.mode=HTML" from pet clinic project somehow had no effect on that project, but in mine - it did have. Turns out I was trying to switch default parser into HTML, which I didn't have. This resulted in mentioned error. Deleting or commenting this line in application.properties solved the problem.

like image 156
asdfgh Avatar answered Nov 11 '22 06:11

asdfgh