zoukankan      html  css  js  c++  java
  • spring整合mybatis二种配置

    第一种:


    <!-- 配置sqlsession -->
    <bean id="sqlsessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="configLocation" value="classpath:SqlSessionMap.xml" />
    </bean>
    <!-- 配置mybatis代理 -->
    <bean id="mapperFactoryBean" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <property name="sqlSessionFactoryBeanName" value="sqlsessionFactory" />
    <property name="basePackage" value="com.ssm.mapper" />
    </bean>

    第二种:

    <!-- 配置sqlsessionFactory -->
    <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="configLocation" value="classpath:mybatisMapConfig.xml"/>
    <property name="mapperLocations" value="classpath:mapper/*Mapper.xml"/>
    </bean>
    <!--配置动态代理 -->
    <bean id="scannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <property name="sqlSessionFactoryBeanName" value="sessionFactory"/>
    <property name="basePackage" value="com.xyh.ssm.*.dao"/>
    </bean>

  • 相关阅读:
    Django部署到服务器
    springboot使用Redis缓存
    ubuntu下pip更换国内源
    ubuntu环境变量文件
    python open找不到路径
    centos 8 安装nginx
    centos8 mysql8的远程访问
    centos 8 安装mysql-server 8
    今日收获
    今日收获
  • 原文地址:https://www.cnblogs.com/xuyuanhai-test/p/7852204.html
Copyright © 2011-2022 走看看