问题描述
controller中的shiro注解不生效导致ShiroRealm中的doGetAuthorizationInfo授权方法未执行.
@RequiresPermissions("user:add")
@RequestMapping("add")
public String userAdd(Model model) {
model.addAttribute("value", "新增用户");
return "user";
}
解决方法
1.ShiroConfig中开启shiro提供的权限相关的注解
/**
* @Title: authorizationAttributeSourceAdvisor
* @Description:开启shiro提供的权限相关的注解
* @param securityManager
* @return AuthorizationAttributeSourceAdvisor
**/
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) {
AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
authorizationAttributeSourceAdvisor.setSecurityManager(secu