【发布时间】:2017-01-11 23:39:36
【问题描述】:
我是 Spring Boot 和 Thymeleaf 的新手,我正在研究一个实现 Spring Security 的示例项目。而且我还想在我的项目中使用 Thymeleaf 安全方言。正如我所读到的,在 Spring Boot 的情况下,无需为安全方言创建配置。 首先我想要实现的是在视图中显示登录用户。 到目前为止我做了什么:
我添加了这个 div 来查看:
<div sec:authentication="name">
The value of the "name" property of the authentication object should appear here.
</div>
并在 pom.xml 中添加了一个依赖:
<!-- https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-springsecurity4 -->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
如果有人有任何想法,请告诉我。
【问题讨论】:
标签: spring spring-security thymeleaf