参考springrain,我的配置文件如下application-shiro.xml
应该就是配置的问题,给你一个我的配置参考下吧
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"
default-lazy-init="true">
<description>Shiro Configuration</description>
<!-- Shiro's main business-tier object for web-enabled applications -->
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"
depends-on="userDao">
<property name="realms">
<list>
<ref bean="shiroDbRealm" />
</list>
</property>
<property name="cacheManager" ref="cacheManager" />
</bean>
<bean id="cacheManager" class="org.apache.shiro.cache.MemoryConstrainedCacheManager" />
<!-- 項目自定义Realm -->
<bean id="shiroDbRealm" class="x.x.x.x.ShiroDbRealm" />
<!-- Shiro Filter -->
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
<property name="securityManager" ref="securityManager" />
<property name="loginUrl" value="/loginui" />
<property name="successUrl" value="" />
<property name="unauthorizedUrl" value="/loginui?unauthorized=true" />
<property name="filterChainDefinitions">
<value>
/weixin/**=anon
/loginui = anon
/loginrdct = anon
/logoutrdct = anon
/createuserui = anon
/showList = anon
/showDetail = anon
/findPassword/** = anon
/regui = anon
/register = anon
/regcheckcerifycode = anon
/checkVerifyCode = anon
/**/checkusername/** = anon
/reguser/** = anon
/login = anon
/logout = customLogoutFilter
/**/static/**= anon
/error/**=anon
/app/**=anon
/verifyCodeServlet = anon
/img/** = anon
/** = customAccessControlFilter,user
</value>
</property>
</bean>
</beans>
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。