Thymeleaf Integration

Learn how to use the Thymeleaf Spring Security integration to improve the user experience.

User-specific views

To improve the user experience, we should hide any buttons, links, or other content that the logged-in user is not supposed to see. To do that, we can use the Thymeleaf Spring Security integration.

Let’s start by adding the needed dependency in pom.xml:

Press + to interact
<dependencies>
...
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
...
</dependencies>

We’ll also edit templates/users/list.html to take the current user role into account when rendering the ...