123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?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:aop="http://www.springframework.org/schema/aop"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx.xsd">
-
- <bean id="jdbcUrlBean" class="com.iamberry.wechat.tools.DataSourceManager"></bean>
- <!--app 前台配置库数据源-->
- <bean id="ratfwDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
- <property name="driverClass" value="#{jdbcUrlBean.jdbcDriver}"></property>
- <property name="jdbcUrl" value="#{jdbcUrlBean.jdbcUrl}"></property>
- <property name="user" value="#{jdbcUrlBean.jdbcUserName}"></property>
- <property name="password" value="#{jdbcUrlBean.jdbcPassword}"></property>
- <!--连接池初始化值 -->
- <property name="initialPoolSize" value="3"></property>
- <!--连接池最大值 -->
- <property name="maxPoolSize" value="#{jdbcUrlBean.maxPoolSize}"></property>
- <!--最小空闲值,当空闲连接少于阀值时,连接池会预申请一些连接 -->
- <property name="minPoolSize" value="2"></property>
- </bean>
-
- <!-- 自动扫描SQL隐射文件 -->
- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
- <!-- basePackage:指定SQL映射文件、接口的包,自动加载SQL映射文件和接口 -->
- <property name="basePackage" value="com.iamberry.app.mapper"></property>
- <!-- 引用SQLSessionFactoryBean -->
- <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
- </bean>
-
- <!-- 配置SqlSessionFactoryBean -->
- <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
- <!-- 配置数据源 -->
- <property name="dataSource" ref="ratfwDataSource" />
- <property name="configLocation" value="classpath:iamberry-app-service-mybatis.xml" />
- <property name="mapperLocations" value="classpath:com/iamberry/app/mapper/*.xml" />
- </bean>
-
- <!-- 开启注解事务 -->
- <tx:annotation-driven transaction-manager="transactionManager"/>
- </beans>
|