在springboot中开启shiro注解支持

在Shiro配置类中注册如下两个Bean

 @Bean
public DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator() {
	DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
	advisorAutoProxyCreator.setProxyTargetClass(true);
	return advisorAutoProxyCreator;
}


@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(@Qualifier("securityManager") DefaultWebSecurityManager securityManager) {
	AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
	authorizationAttributeSourceAdvisor.setSecurityManager(securityManager); // 这里需要注入 SecurityManger 安全管理器
	return authorizationAttributeSourceAdvisor;
}

上一篇:Shiro+JWT在前后端分离项目中实现认证授权


下一篇:【Redis 系列】redis 学习四,set 集合,hash 哈希,zset 有序集合初步认知