团队对封装组件的代码范例

ipu-mybatis-config.xml 3.1KB

    <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <settings> <setting name="defaultFetchSize" value="1000" /> <!-- 结果集获取数量提示值,分批传输 --> </settings> <plugins> <!-- 分页插件,可根据参数定制化 --> <plugin interceptor="com.github.pagehelper.PageInterceptor"> <!-- config params as the following --> </plugin> <plugin interceptor="com.ai.ipu.sql.mgmt.mybatis.SqlMgmtPlugin"> </plugin> </plugins> <environments default="db_druid"> <environment id="db_druid"> <transactionManager type="JDBC" /> <dataSource type="com.ai.ipu.database.datasource.DruidDataSourceFactory"> <property name="driverClass" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://47.105.160.21:3307/test" /> <property name="username" value="iputest" /> <property name="password" value="iputest@321" /> <!-- 连接池用完时,等待获取新连接的时间 (毫秒) --> <property name="maxWait" value="5000" /> <!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 --> <!--<property name="acquireRetryAttempts" value="5" />--> <!--两次连接中间隔时间,单位毫秒。Default: 1000 --> <!--<property name="acquireRetryDelay" value="1000" />--> <property name="initialSize" value="3" /> <property name="minIdle" value="3" /> <property name="maxActive" value="3" /> <!--<property name="maxIdleTime" value="600" />--> <!--<property name="idleConnectionTestPeriod" value="60" />--> <property name="validationQuery" value="SELECT 1" /> </dataSource> </environment> <environment id="db"> <transactionManager type="JDBC"/> <dataSource type="com.ai.ipu.database.datasource.DruidDataSourceFactory"> <property name="url" value="jdbc:mysql://121.42.183.206:3307/mbaas_app_mgmt"/> <property name="username" value="ipu"/> <property name="password" value="ipumysql"/> <!-- 配置获取连接的等待超时时间 --> <property name="maxWait" value="60000"/> <!-- 配置初始化大小、最小、最大 --> <property name="initialSize" value="1"/> <property name="minIdle" value="1"/> <property name="maxActive" value="20"/> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 --> <property name="minEvictableIdleTimeMillis" value="300000"/> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 --> <property name="timeBetweenEvictionRunsMillis" value="60000"/> <property name="validationQuery" value="SELECT 'x'"/> <property name="testWhileIdle" value="true"/> <property name="testOnBorrow" value="false"/> <property name="testOnReturn" value="false"/> <!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 --> <property name="filters" value="stat"/> </dataSource> </environment> </environments> </configuration>