• shiro添加注解@RequiresPermissions不起作用


    这是因为没有开启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>
  • 相关阅读:
    Python 对象的绑定方法
    Python 类的属性
    Python 对象与类
    Python 面向对象
    Python Subprocess模块
    Python Hashlib模块
    Python Configparser模块
    Python XML模块
    Python Re模块
    Gridview中Datakeys 通过主键取得各列的值。(转)
  • 原文地址:https://www.cnblogs.com/qlong8807/p/5524350.html
Copyright © 2020-2023  润新知