在spring-mvc.xml文件中写入如下 我的gihtub网址 下载 github下载网址:https://github.com/zhongsangyang/Shiro-RequirePermission
<!-- 开启shiro注解--> <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"></bean><bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor"> <property name="proxyTargetClass" value="true"/> </bean> <!--<bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">--> <!--<property name="securityManager" ref="securityManager"></property>--> <!--</bean>--> <bean class="com.factory.CustomerAuthorizationAttributeSourceAdvisor"> <property name="securityManager" ref="securityManager"></property> </bean>
看到红色的这个类,点这个红色类ctrl +左键点击进shiro源码里面查看。
分别重写图上箭头标的类,本人都在前面加了Customer前缀。