thymeleaf sec:authorize="hasRole('ROLE_ADMIN') 无效

1,165 阅读1分钟
" class="hljs "><div sec:authorize="hasRole('ROLE_USER')">
<div sec:authorize="hasRole('ROLE_ADMIN')">
无效

修改
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
无效

查看gradle依赖 org.thymeleaf.extras:thymeleaf-extras-java8time

添加 compile('org.thymeleaf.extras:thymeleaf-extras-springsecurity4')