Spring and Thymeleaf: HTML Template Mode Not Configured

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

Trying to create my own basic spring project, I want to use thimeleaf, and I don’t know what is happening, because I constantly get the error message "HTML template mode not configured."

I try to study this by analyzing a pet clinic project, then I started hiding in a tutorial: http://www.thymeleaf.org/doc/tutorials/3.0/thymeleafspring.html and there is information about engines and restorers that aren't in pet clinic project.

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

+5
source share
2 answers

So, I tried everything I could and it turned out that the reason for this was that the default thymeleaf parser for HTML5 (this means that the spring.thymeleaf.mode property in the application.properties file is equal to HTML5).

The default value is application.properties: http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

The line "spring.thymeleaf.mode = HTML" from the pet clinic project didn’t somehow influence this project, but I had it. Turns out I was trying to switch the default parser to HTML, which I didn't have. This led to the indicated error. Removing or commenting out this line in application.properties solved the problem.

+3
source

Looks like you're not using Spring Boot? This github (pet-clinic) project is done using Spring Boot. In Spring boot, almost all configurations are abstracted. This means that legacy configurations that are hidden from code are already configured. These include ViewResolver configurations, so you cannot see this from the code base.

0
source

Source: https://habr.com/ru/post/1260098/


All Articles