Skip to main content

Thymeleaf Integrations

Thymeleaf is intentionally built heavily for deep Spring Framework integration.

Spring MVC Integration

Thymeleaf serves natively as a specialized ViewResolver. To integrate it with Spring MVC, you simply add the spring-boot-starter-thymeleaf dependency to your pom.xml, and the TemplateEngine bean configures automatically.

Spring Security Dialect

Thymeleaf provides an explicit thymeleaf-extras-springsecurity package. This allows you to evaluate user authentication roles directly inside the HTML template to conditionally render UI components like "Admin Dashboards" or "Login" buttons.

<div sec:authorize="hasAuthority('ADMIN')">
<button>Delete User Data</button>
</div>