zoukankan      html  css  js  c++  java
  • mybatis-config.xml配置

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.0.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">

    <!-- Activates annotation-based bean configuration -->
    <context:annotation-config />

    <!-- 导入属性配置文件 -->
    <!--
    <context:property-placeholder location="classpath:orcl.properties" order="1" />
    -->
    <!-- 配置数据源 -->
    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
    init-method="init" destroy-method="close">
    <property name="driverClassName" value="${ora.jdbc.driverClassName}" />
    <property name="url" value="${ora.jdbc.url}" />
    <property name="username" value="${ora.jdbc.username}" />
    <property name="password" value="${ora.jdbc.password}" />
    <property name="minIdle" value="${ora.jdbc.minIdle}" /> <!-- 队列中的最小等待数 -->
    <!-- <property name="maxIdle" value="${ora.jdbc.maxIdle}" /> 队列中的最大等待数 -->
    <property name="maxWait" value="${ora.jdbc.maxWait}" /> <!-- 最长等待时间,单位毫秒 -->
    <property name="maxActive" value="${ora.jdbc.maxActive}" /> <!-- 最大活跃数 -->
    <property name="initialSize" value="${ora.jdbc.initialSize}" /><!-- 初始大小 -->
    <property name="filters" value="stat" /><!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 -->

    <property name="validationQuery" value="${ora.jdbc.validationQuery}" />
    <property name="testWhileIdle" value="true" />
    <property name="testOnBorrow" value="false" />
    <property name="testOnReturn" value="false" />

    </bean>

    <!-- 使用JDBC事物 -->
    <bean id="oraTxManager"
    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource" />
    </bean>

    <!-- 使用annotation定义事务 -->
    <tx:annotation-driven transaction-manager="oraTxManager"
    proxy-target-class="true" />

    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="configLocation" value="classpath:sqlMapConfig.xml" />
    <property name="dataSource" ref="dataSource" />

    <property name="mapperLocations" value="classpath:com/syy/sys/**/domain/*Mapper.xml"></property>
    <property name="plugins">
    <!-- <list> -->
    <!-- <bean -->
    <!-- class="com.github.miemiedev.mybatis.paginator.OffsetLimitInterceptor"> -->
    <!-- <property name="dialectClass" -->
    <!-- value="com.github.miemiedev.mybatis.paginator.dialect.SQLServer2005Dialect"></property> -->
    <!-- </bean> -->
    <!-- </list> -->
    <array>
    <bean class="com.github.pagehelper.PageHelper" />
    </array>
    </property>


    </bean>

    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <!--
    <property name="annotationClass" value="org.springframework.stereotype.Repository" />
    -->
    <property name="basePackage" value="com.syy.sys.domain.mapper" />
    <!--
    <property name="sqlSessionFactory" ref="sqlSessionFactory" />
    -->

    </bean>


    </beans>

  • 相关阅读:
    《当程序员的那些狗日日子》(六)继续熬夜学习的日子
    《当程序员的那些狗日日子》(四)喘过气来了
    《当程序员的那些狗日日子》(二)走上不归路
    《当程序员的那些狗日日子》(八)床上等你
    《当程序员的那些狗日日子》(一)毕业后的徘徊
    wince定时拍照功能(转)
    Excel公式找出某一列中是否有某值
    2010年到10月的流水帐
    不错的windows phone的博客
    将同一个表中的一个域更新到另外一个域的SQL文
  • 原文地址:https://www.cnblogs.com/YuyuanNo1/p/7573525.html
Copyright © 2011-2022 走看看