shiro添加注解@RequiresPermissions不起作用
2016-05-24 17:59
399 查看
这是因为没有开启spring拦截器,在spring-mvc.xml中加入以下代码就可以了(一定要写在最先加载的xml中,写在后面加载的xml中也不起作用)
<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor" /> <bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor"> <property name="securityManager" ref="securityManager" /> </bean>
lifecycleBeanPostProcessor和securityManager是在shiro配置文件中定义好的:
<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"></bean> <!-- Shiro安全管理器 --> <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"> <property name="realm" ref="jdbcRealm"></property> <property name="cacheManager" ref="cacheManager"></property> </bean>
相关文章推荐
- 自定义TabBar中间的Item
- UINavigationController 右滑返回
- 例题9-10 UVa1626&&POJ1141 Brackets Sequence(DP)
- UI进阶 即时通讯之XMPP环境搭建
- php小知识点-文件包含(include include_once require require_once)
- iOS不得姐项目--封装状态栏指示器(UIWindow实现)
- 字典的快速赋值 setValuesForKeysWithDictionary
- 本地推送 UILocalNotification
- Ubuntu 12.04 64位上运行jd-gui
- 顺序查找(Sequential Search)
- UI更新就该放到主线程
- UIControl详解
- 比较2张图片UIImage是否相同
- Missing ios distribution signing identity xcode can request one for you
- UI进阶 即时通讯之卸载Openfire
- 最近做easy-ui要用到的formatter()
- [转]WinForms GridListEditor - How to restore values in the auto filter row
- 05.LoT.UI 前后台通用框架分解系列之——漂亮的时间选择器
- 04.LoT.UI 前后台通用框架分解系列之——轻巧的弹出框
- ios UITableview 刷新某一个cell 或 section