4ec520dd2e95ae6506336280699159e29fd1caf3.svn-base 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:aop="http://www.springframework.org/schema/aop"
  5. xmlns:context="http://www.springframework.org/schema/context"
  6. xmlns:tx="http://www.springframework.org/schema/tx"
  7. xmlns:p="http://www.springframework.org/schema/p"
  8. xsi:schemaLocation="http://www.springframework.org/schema/beans
  9. http://www.springframework.org/schema/beans/spring-beans.xsd
  10. http://www.springframework.org/schema/aop
  11. http://www.springframework.org/schema/aop/spring-aop.xsd
  12. http://www.springframework.org/schema/context
  13. http://www.springframework.org/schema/context/spring-context.xsd
  14. http://www.springframework.org/schema/tx
  15. http://www.springframework.org/schema/tx/spring-tx.xsd">
  16. <bean id="jdbcUrlBean" class="com.iamberry.wechat.tools.DataSourceManager"></bean>
  17. <!--app 前台配置库数据源-->
  18. <bean id="ratfwDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
  19. <property name="driverClass" value="#{jdbcUrlBean.jdbcDriver}"></property>
  20. <property name="jdbcUrl" value="#{jdbcUrlBean.jdbcUrl}"></property>
  21. <property name="user" value="#{jdbcUrlBean.jdbcUserName}"></property>
  22. <property name="password" value="#{jdbcUrlBean.jdbcPassword}"></property>
  23. <!--连接池初始化值 -->
  24. <property name="initialPoolSize" value="3"></property>
  25. <!--连接池最大值 -->
  26. <property name="maxPoolSize" value="#{jdbcUrlBean.maxPoolSize}"></property>
  27. <!--最小空闲值,当空闲连接少于阀值时,连接池会预申请一些连接 -->
  28. <property name="minPoolSize" value="2"></property>
  29. </bean>
  30. <!-- 自动扫描SQL隐射文件 -->
  31. <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
  32. <!-- basePackage:指定SQL映射文件、接口的包,自动加载SQL映射文件和接口 -->
  33. <property name="basePackage" value="com.iamberry.app.mapper"></property>
  34. <!-- 引用SQLSessionFactoryBean -->
  35. <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
  36. </bean>
  37. <!-- 配置SqlSessionFactoryBean -->
  38. <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  39. <!-- 配置数据源 -->
  40. <property name="dataSource" ref="ratfwDataSource" />
  41. <property name="configLocation" value="classpath:iamberry-app-service-mybatis.xml" />
  42. <property name="mapperLocations" value="classpath:com/iamberry/app/mapper/*.xml" />
  43. </bean>
  44. <!-- 开启注解事务 -->
  45. <tx:annotation-driven transaction-manager="transactionManager"/>
  46. </beans>