springmvc + shiro 整合,shiro注解无效什么鬼

如题所述

不知道你解决了没,你是不是用了springmvc,如果使用springmvc的话,在springmvc-servlet.xml文件中也要添加几行shiro需要使用的代码,添加内容如下:
<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<props>
<prop "org.apache.shiro.authz.UnauthorizedException">/403</prop>
</props>
</property>
</bean>
<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>

这样在使用shiro的权限注解的时候就可用了
温馨提示:答案为网友推荐,仅供参考
相似回答