ssm框架使用MybatisPlus在配置sqlSessionFactory时报“Cannot resolve class ‘MybatisSqlSessionFactoryBean‘”

时间:2025-04-27 11:11:01

在百度搜索在配置时class引入的是“”引入后报错

改成class=“”正常使用

  <!-- mybatis和spring完美整合,不需要mybatis的配置映射文件 -->
    <bean  class="">
        <property name="dataSource" ref="dataSource"/>
        <!-- 加载mybatis配置文件 -->
        <property name="configLocation" value="classpath:" />
        <!-- 自动扫描文件 -->
        <property name="mapperLocations" value="classpath:mapping/*.xml"></property>

        <!-- 别名处理 -->
        <property name="typeAliasesPackage" value=""></property>
        <!-- 配置插件 -->
        <property name="plugins">
            <list>
                <!-- 分页插件 -->
                <bean class=""/>
            </list>
        </property>

    </bean>

或者改成:class=""

 <!-- mybatis和spring完美整合,不需要mybatis的配置映射文件 -->
    <bean  class="">
        <property name="dataSource" ref="dataSource"/>
        <!-- 加载mybatis配置文件 -->
        <!--<property name="configLocation" value="classpath:" />-->
        <!-- 自动扫描文件 -->
        <property name="mapperLocations" value="classpath:mapping/*.xml"></property>

        <!-- 别名处理 -->
        <property name="typeAliasesPackage" value=""></property>
        <!-- 配置插件 -->
        <property name="plugins">
            <list>
                <!-- 分页插件 -->
                <bean class=""/>
            </list>
        </property>

    </bean>