为了账号安全,请及时绑定邮箱和手机立即绑定

发布项目提示ShiroFilterFactoryBean找不到,但是包是导入了的

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.shiro.spring.web.ShiroFilterFactoryBean] for bean with name 'shiroFilter' defined in class path resource [spring/spring.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.shiro.spring.web.ShiroFilterFactoryBean



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <context:component-scan base-package="com.imooc"/>

    <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
        <property name="securityManager" ref="securityManager"/>
        <property name="loginUrl" value="login.html"/>
        <property name="unauthorizedUrl" value="403.html"/>
        <property name="filterChainDefinitions">
            <value>
                /login.html = anon
                /subLogin = anon
                /*=authc
            </value>
        </property>
    </bean>

    <!--创建securityManager -->
    <bean class="org.apache.shiro.web.mgt.DefaultWebSecurityManager" id="securityManager" >
        <property name="realm" ref="real" />
    </bean>
    <bean class="com.imooc.shiro_realm.CustomRealm" id="real">
    </bean>

    <bean class="org.apache.shiro.authc.credential.HashedCredentialsMatcher" id="hashedCredentialsMatcher">
        <property name="hashAlgorithmName" value="md5"/>
        <property name="hashIterations" value="1"/>
    </bean>
    <!-- 配置数据源 -->
    <bean name="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
        <property name="url" value="${jdbc.jdbcUrl}" />
        <property name="username" value="${jdbc.user}" />
        <property name="password" value="${jdbc.password}" />
        <property name="initialSize" value="1" />
        <property name="maxActive" value="20" />
        <property name="minIdle" value="1" />
        <property name="maxWait" value="60000" />
        <property name="validationQuery" value="true" />
        <property name="testOnBorrow" value="false" />
        <property name="testOnReturn" value="false" />
        <property name="testWhileIdle" value="true" />
        <property name="timeBetweenEvictionRunsMillis" value="60000" />
        <property name="minEvictableIdleTimeMillis" value="25200000" />
        <property name="removeAbandoned" value="true" />
        <property name="removeAbandonedTimeout" value="1800" />
        <property name="logAbandoned" value="true" />
        <property name="filters" value="stat,wall"/>
        <!-- <property name="connectionProperties" value="config.decrypt=true;config.decrypt.key=${publickey}" /> -->
    </bean>
    <!--<bean class="org.springframework.jdbc.core.JdbcTemplate" id="jdbcTemplate">
        <property name="dataSource" ref="dataSource" />
    </bean>-->
    <!-- myBatis文件 -->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="configLocation" value="classpath:mybatis/MyBatis-Configuration.xml" />
        <property name="mapperLocations" value="classpath:com/imooc/dao/mapper/**/*Mapper.xml" />
        <!-- <list>
            <value>classpath*:com/mssm/dao/admin/mapper/*Mapper.xml</value>
            <value>classpath*:com/mssm/dao/menu/mapper/*Mapper.xml</value>
        </list>
    </property> -->
    </bean>

    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="com.imooc.dao" />
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
    </bean>

    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="markerInterface" value="tk.mybatis.mapper.common.Mapper"/>
    </bean>

    <!-- 配置事务管理器 -->
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource" />
    </bean>

</beans>


正在回答

2 回答

你的spring配置文件出现问题   filter名字要和web.xml中名字一样才行

0 回复 有任何疑惑可以回复我~

web.xml有注入吗

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

发布项目提示ShiroFilterFactoryBean找不到,但是包是导入了的

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信