在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,shiro)