If you are using Intellij IDEA, you can also use the JBLHtmlToThymeleaf plugin. With this plugin, you can simply right click on your HTML file and add the required namespace.
Operation steps for this: (on the IDE)
File
->Settings
->Plugins
->Marketplace
and search JBLHtmlToThymeleaf
Install JBLHtmlToThymeleaf
After the installation is complete, right click on a desired html file and select JBLHtmlToThymeleaf.
Right click the HTML file
After the process is complete, you will see that the namespace xmlns: th = "http://www.thymeleaf.org"
has been added automatically.
Bonus: Also if you want to use Spring Security in HTML file, don't forget to add xmlns: sec = "http://www.thymeleaf.org/extras/spring-security"
.