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>

  • 相关阅读:
    Nodejs核心模块之net和http的使用详解
    Node基础:1
    js中const,var,let区别
    count(1)与count(*)比较
    基于物联网实现的智能物流系统
    树莓派 Learning 002 装机后的必要操作 --- 07 设置静态IP地址
    树莓派 Learning 002 装机后的必要操作 --- 06 共用键鼠 之 windows和树莓派
    Ubuntu Linux 使用桂电校园网 上网
    树莓派 Learning 002 装机后的必要操作 --- 00 修改键盘布局
    树莓派 Learning 002 装机后的必要操作 --- 05 给树莓派搭建“x86 + pi”环境 -- 安装**32位运行库** -- 解决`E:未发现软件包 xxx` 问题
  • 原文地址:https://www.cnblogs.com/YuyuanNo1/p/7573525.html
Copyright © 2011-2022 走看看