SpringBoot&x2B;百里香叶+;安全方言如何配置?
我是SpringBoot的新手,Thymeleaf和我正在进行一个示例项目,该项目正在实现SpringSecurity。我还想在我的项目中使用Thymeleaf安全方言。正如我所读到的,在Spring引导的情况下,不需要为安全方言创建配置。 首先,我想实现的是在视图中显示登录的用户。 到目前为止我所做的: 我将此div添加到视图中:SpringBoot&x2B;百里香叶+;安全方言如何配置?,spring,spring-security,thymeleaf,Spring,Spring Security,Thymeleaf,我是SpringBoot的新手,Thymeleaf和我正在进行一个示例项目,该项目正在实现SpringSecurity。我还想在我的项目中使用Thymeleaf安全方言。正如我所读到的,在Spring引导的情况下,不需要为安全方言创建配置。 首先,我想实现的是在视图中显示登录的用户。 到目前为止我所做的: 我将此div添加到视图中: <div sec:authentication="name"> The value of the "name" property
<div sec:authentication="name">
The value of the "name" property of the authentication object should appear here.
</div>
身份验证对象的“name”属性的值应显示在此处。
并在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>
org.thymeleaf.extras
thymeleaf-extras-springsecurity4
3.0.0.1版本
如果有人有任何想法,请告诉我。我解决了这个问题,或者我找到了解决方案。
问题是我使用了
3.0.0.RELEASE
版本的thymeleaf-extras-springsecurity4
。使用2.1.2.RELEASE
可以正常工作。在spring boot中,您不必指定thymeleaf-extras-springsecurity4的版本,如果不指定版本,是否有任何更新?