How to Create Spring boot application with Thymeleaf support

If you're wondering how you can integrate Thymeleaf template engine into your Spring Boot application, here's how:

First of all, you need to add Thymeleaf dependency in pom.xml

Make sure that all your html templates are placed under resources/templates directory

Just in case if you don't want to keep the templates under default directory as above, and if you have your own custom path to store templates, then you can configure that in application.properties by adding the below mentioned entries to it.

Now all we have to to do is to return a view name in your Controller and rest will be taken care by Thymeleaf.

Here is the cnf.html:

And here is the output:



要查看或添加评论,请登录

Rahul Raj的更多文章

社区洞察

其他会员也浏览了