zoukankan      html  css  js  c++  java
  • 配置【MapperScannerConfigurer】提示【SqlSessionFactory to use in the case that there is more than one in the spring context.】

    在配置MapperScannerConfigurer的时候一直提示我如下信息,虽然不影响代码运行但是看着很烦,仔细看提示信息才发现,它再说如果只有一个数据源的话你不需要配置SqlSessionFactory。所以把提示报差的那航配置文件注释掉就好了。

    错误原文:

    Specifies which SqlSessionFactory to use in the case that there is more than one in the spring context. Usually this is only needed when you 
    have more than one datasource. Note bean names are used, not bean references. This is because the scanner loads early during the start process and it is too early to build mybatis object instances.

    【我的配置文件】

       <!-- 使用自动扫描创建mapper bean -->
        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
            <property name="basePackage" value="com.lcy.mapper" />
            <property name="SqlSessionFactoryBeanName" value="SqlSessionFactory" />
            <property name="annotationClass" value="org.springframework.stereotype.Repository" />
        </bean>

    【正确的配置文件】

     <!-- 使用自动扫描创建mapper bean -->
        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
            <property name="basePackage" value="com.lcy.mapper" />
            <property name="annotationClass" value="org.springframework.stereotype.Repository" />
        </bean>
    多个数据源配置参见:https://blog.csdn.net/tan554334064/article/details/52188885
  • 相关阅读:
    ASP.NET 2.0 中改进的缓存功能
    Python 一门神奇的语言
    showModalDialog()、showModelessDialog()方法使用详解
    在VS2005中 GridView导入Excel的两点小技巧附源码
    DVB码流中业务信息与电子节目指南
    js 日历控件
    js收藏
    什么是ECM,EMM,AU,EMU?
    精解PSISI(一)
    Oracle第四课(学习笔记)
  • 原文地址:https://www.cnblogs.com/ywtk/p/10490785.html
Copyright © 2011-2022 走看看