This example is a very simple Spring Boot application.
Maven Dependencies
At first add the following dependencies to your project. Spring Initializr is recommended when you create a new project.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spr...
You can show username for autenticated users
<div sec:authorize="isAuthenticated()">
Welcome, <span sec:authentication="name">Username</span>
</div>
The sec:authorize attribute renders its content when the attribute expression is evaluated to true
<div sec:authorize="hasRole('ROLE_ADMIN')">
Content for administrators
</div>
<div sec:authorize="hasRole('ROLE_USER')">
Content for users
</div&g...