其他分享
首页 > 其他分享> > 在springboot中开启shiro注解支持

在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;
}

标签:springboot,advisorAutoProxyCreator,securityManager,Bean,DefaultAdvisorAutoProxyC
来源: https://blog.csdn.net/qq_42418169/article/details/117068071