1.将prePostEnabled设置为true:@EnableGlobalMethodSecurity(prePostEnabled=true)
2.如果还是不起作用查看是否缺少aop依赖(小编当时不起作用就是缺少这个依赖):
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
1.将prePostEnabled设置为true:@EnableGlobalMethodSecurity(prePostEnabled=true)
2.如果还是不起作用查看是否缺少aop依赖(小编当时不起作用就是缺少这个依赖):
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>