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>

  • 相关阅读:
    [PHP]socket的连接超时 与 读取/写入超时
    [PHP]引用返回与节省内存
    [PHP]实体类基类和序列化__sleep问题
    [PHP]日志处理error_log()函数和配置使用
    [PHP] 使用反射实现的控制反转
    [PHP] debug_backtrace()可以获取到代码的调用路径追踪
    [TCP/IP] TCP的传输连接管理
    [PHP] sys_get_temp_dir()和tempnam()函数报错与环境变量的配置问题
    [PHP] ubuntu下使用uuid扩展获取uuid
    [Linux] host dig nslookup查询域名的DNS解析
  • 原文地址:https://www.cnblogs.com/YuyuanNo1/p/7573525.html
Copyright © 2011-2022 走看看