dataSource.xml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:jdbc="http://www.springframework.org/schema/jdbc"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xmlns:jee="http://www.springframework.org/schema/jee"
  6. xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
  7. http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
  8. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
  9. <!-- 可通过web.xml中设置以下内容,选择激活不同的数据源
  10. <context-param>
  11. <param-name>spring.profiles.active</param-name>
  12. <param-value>developer</param-value>
  13. </context-param>
  14. -->
  15. <!-- 开发环境数据源 @ActiveProfiles("developer") -->
  16. <beans profile="developer"><!--内存数据库 -->
  17. <jdbc:embedded-database id="dataSource" type="H2">
  18. <!-- ;
  19. <jdbc:script location="classpath:database/meishiqq-schema.sql"/>
  20. <jdbc:script location="classpath:database/meishiqq-dataload.sql"/>
  21. -->
  22. </jdbc:embedded-database>
  23. </beans>
  24. <!-- 生产环境数据源 @ActiveProfiles("production") -->
  25. <beans profile="production"><!-- 数据连接池 -->
  26. <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
  27. <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  28. <!-- -->
  29. <property name="url" value="jdbc:mysql://192.168.33.159:3306/p2p21_piaojuke_czbank?useUnicode=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull" />
  30. <property name="username" value="root" />
  31. <property name="password" value="p2p_zdsoft!" />
  32. <!-- druid 连接池的 -->
  33. <property name="filters" value="stat" />
  34. <!-- 下面druid 和 dbcp 连接池通用的 ↓↓↓↓↓↓↓↓↓↓↓↓ -->
  35. <!--maxActive: 最大连接数量 -->
  36. <property name="maxActive" value="20" />
  37. <!--initialSize: 初始化连接 -->
  38. <property name="initialSize" value="5" />
  39. </bean>
  40. </beans>
  41. </beans>