有可能是以下问题:
1.未引入依赖
maven:
<!--springsecurity4 要指定3.0以上版本,否则权限标签可能无法工作-->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
<version>3.0.2.RELEASE</version>
</dependency>
gradle:
compile ('org.thymeleaf.extras:thymeleaf-extras-springsecurity4 : 3.0.2.RELEASE')
2.未指明版本号
代码如上
3.(最骚的是)如果指明了版本号还未生效,那么引入依赖的时候去掉版本号再试