SpringSecurity笔记2

87 阅读1分钟

@Repository 和@Mapper 可处理@Autowired报错 hasRole 需要加ROLE_前缀 无访问权限跳转页面设置

http.exceptionHandling().accessDeniedPage("/unauth.html");

注解使用 @EnableGlobalMethodSecurity(securedEnabled = true,prePostEnabled = true) 开启使用注解 @PreAuthorize 适合进入方法钱的权限验证 @PostAuthorize 方法执行之后进行验证 @Secured 用户具有某个角色可以进行访问 @PostFilter 对返回数据进行过滤 @PreFilter 对传入数据进行过滤