当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