zoukankan      html  css  js  c++  java
  • applicationContext-dao.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:context="http://www.springframework.org/schema/context"
        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">
    
        <!-- <context:property-placeholder location="classpath:resources/jdbc.properties" /> -->
        
        <!-- 扫描redis的类,让spring管理起来,需要在该类中注入 JedisCluster实例,所以需要扫描-->
        <context:component-scan base-package="com.jy.me.dao.impl" />
        
      <context:property-placeholder location="classpath:resources/*.properties" /> <!-- 使用droid的数据库连接池 --> <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close"> <property name="driverClassName" value="${jdbc.driverClass}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.user}" /> <property name="password" value="${jdbc.password}" /> <property name="initialSize" value="${droid.initialSize}" /> <property name="maxActive" value="${droid.maxActive}" /> <property name="minIdle" value="${droid.minIdle}" /> </bean>
      

        <!-- 配置数据源  使用c3p0-->
        <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
            <property name="driverClass" value="${jdbc.driverClass}" />
            <property name="jdbcUrl" value="${jdbc.url}" />
            <property name="user" value="${jdbc.username}" />
            <property name="password" value="${jdbc.password}" />
            <property name="maxPoolSize" value="${c3p0.maxPoolSize}" />
            <property name="minPoolSize" value="${c3p0.minPoolSize}" />
            <property name="initialPoolSize" value="${c3p0.initialPoolSize}" />
        </bean>

        <!-- mybatis的SqlSessionFactory -->
        <bean class="org.mybatis.spring.SqlSessionFactoryBean">
            <property name="configLocation" value="classpath:mybatis/mybatisConfig.xml" />
            <property name="dataSource" ref="dataSource" />
        </bean>
        
        <!-- 使用扫描包的方式生成mybatis的mapper代理对象 -->
        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
            <property name="basePackage" value="com.jy.me.mapper" />
        </bean>
    
    </beans>
    人生没有彩排,每天都是现场直播!
  • 相关阅读:
    玩具数据库
    数据库中可能会出现的表
    SqlDbHelper
    重写 覆盖 虚方法
    页面标签的初始化
    如何将UTF8转换为UTF8n
    小软件项目开发的管理(转)
    SCRUM软件开发过程(转)
    在.Net如何制作自定义的快捷方式
    What Is a Leader
  • 原文地址:https://www.cnblogs.com/northern-light/p/8539152.html
Copyright © 2011-2022 走看看