zoukankan      html  css  js  c++  java
  • 配置Spring整合mybatis框架的SqlSessionFactoryBean

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           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
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
    
        <!--    数据源-->
        <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
            <property name="driverClass" value="com.mysql.jdbc.Driver"></property>
            <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/one"></property>
            <property name="user" value="root"></property>
            <property name="password" value="admin123"></property>
        </bean>
    
        <!--    配置Spring整合mybatis框架的SqlSessionFactoryBean-->
        <bean id="MySqlSeeeionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean">
            <!--    引入数据源-->
            <property name="dataSource" ref="dataSource"></property>
            <!--    扫描实体类包,批量创建别名-->
            <property name="typeAliasesPackage" value="com.domain"></property>
        </bean>
    
    
        <!--    mapper扫描器,对相对应的映射文件进行扫描-->
        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
            <property name="basePackage" value="com.mapper"></property>
        </bean>
    
    
    </beans>
    
  • 相关阅读:
    Task示例,多线程
    request
    do put in ruby
    Ruby零星笔记
    Git的常用操作
    如何在Rails中执行Get/Post/Put请求
    Lua中的基本函数库
    Step By Step(Lua目录)
    position:fixed失效原因
    前端性能监控-window.performance.timing篇
  • 原文地址:https://www.cnblogs.com/lyd447113735/p/14469962.html
Copyright © 2011-2022 走看看