@Secured

判断是否具有角色 匹配字符串加前缀ROLE_

//在启动类中开启注解
@EnableGlobalMethodSecurity(securedEnabled = true)
//使用
@secured({"ROLE_admin","ROLE_sa"})

@PreAuthorie

进入方法前的权限验证

//开启权限
@EnableGlobalMethodSecurity(prePostEnabled = true)
//使用
@PreAuthorize("hasAnyAuthority('admin:list')")