當shiro做成動態URL管理時出現循環注入BeanCurrentlyInCreationException的問題解決方法


<!-- Shiro的Web過濾器 -->
    <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
        <property name="securityManager" ref="securityManager"/>

    </bean>

    <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="targetObject" ref="shiroFilter"/>
        <property name="targetMethod" value="setFilterChainResolver"/>
        <property name="arguments" ref="filterChainResolver"/>
    </bean>

改為

@Bean
    public ShiroFilterFactoryBean shiroFilterFactoryBean() throws Exception{
        ShiroFilterFactoryBean bean = new ShiroFilterFactoryBean();
        bean.setSecurityManager(securityManager());
        AbstractShiroFilter shiroFilter = (AbstractShiroFilter)bean.getObject();
        shiroFilter.setFilterChainResolver(pathMatchingFilterChainResolver());
        return bean;
    }

就可以解決,具體到底哪里的錯我也沒搞懂。

spring集成shiro的具體方案,請看開濤大神的博客:http://jinnianshilongnian.iteye.com/blog/2040929


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM