【问题标题】:SpringBoot + Thymeleaf + Security Dialect how to configure?SpringBoot + Thymeleaf + Security Dialect 怎么配置?
【发布时间】: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


    【解决方案1】:

    我解决了这个问题,或者我找到了解决方案。 问题是我使用了3.0.0.RELEASEthymeleaf-extras-springsecurity4 版本。使用2.1.2.RELEASE 可以正常工作。

    【讨论】:

    • 在spring boot中,你不必指定thymeleaf-extras-springsecurity4的版本,不指定版本有什么更新吗?
    猜你喜欢
    • 2017-08-16
    • 2017-09-10
    • 2013-07-02
    • 2019-04-14
    • 2021-04-05
    • 1970-01-01
    • 2019-07-02
    • 2018-01-13
    • 2011-04-04
    相关资源
    最近更新 更多