xxl-job

applicationcontext-database.xml 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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" xmlns:context="http://www.springframework.org/schema/context"
  4. xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
  5. xsi:schemaLocation="
  6. http://www.springframework.org/schema/beans
  7. http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  8. http://www.springframework.org/schema/context
  9. http://www.springframework.org/schema/context/spring-context-3.0.xsd
  10. http://www.springframework.org/schema/aop
  11. http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
  12. http://www.springframework.org/schema/tx
  13. http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
  14. <context:annotation-config />
  15. <context:component-scan base-package="com.xxl.service.impl, com.xxl.dao.impl" />
  16. <!-- c3p0:Main数据源 -->
  17. <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
  18. <property name="driverClass" value="${c3p0.driverClass}" />
  19. <property name="jdbcUrl" value="${c3p0.url}" />
  20. <property name="user" value="${c3p0.user}" />
  21. <property name="password" value="${c3p0.password}" />
  22. <property name="initialPoolSize" value="3" />
  23. <property name="minPoolSize" value="2" />
  24. <property name="maxPoolSize" value="10" />
  25. <property name="maxIdleTime" value="60" />
  26. <property name="acquireRetryDelay" value="1000" />
  27. <property name="acquireRetryAttempts" value="10" />
  28. <property name="preferredTestQuery" value="SELECT 1" />
  29. </bean>
  30. <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  31. <property name="dataSource" ref="dataSource" />
  32. <property name="mapperLocations" value="classpath*:com/xxl/core/model/mapper/*.xml"/>
  33. </bean>
  34. <!-- Template在Junit测试的时候,必须使用scope="prototype",原因未知 -->
  35. <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">
  36. <constructor-arg index="0" ref="sqlSessionFactory" />
  37. </bean>
  38. </beans>