applicationcontext-xxl-job.xml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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:context="http://www.springframework.org/schema/context"
  5. xsi:schemaLocation="http://www.springframework.org/schema/beans
  6. http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  7. http://www.springframework.org/schema/context
  8. http://www.springframework.org/schema/context/spring-context-3.0.xsd">
  9. <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  10. <property name="fileEncoding" value="utf-8" />
  11. <property name="locations">
  12. <list>
  13. <value>classpath*:xxl-job-executor.properties</value>
  14. </list>
  15. </property>
  16. </bean>
  17. <!-- ********************************* 基础配置 ********************************* -->
  18. <!-- 配置01、JobHandler 扫描路径 -->
  19. <context:component-scan base-package="com.xxl.job.executor.service.jobhandler" />
  20. <!-- 配置02、执行器 -->
  21. <bean id="xxlJobExecutor" class="com.xxl.job.core.executor.XxlJobExecutor" init-method="start" destroy-method="destroy" >
  22. <!-- 执行器IP[选填],为空则自动获取 -->
  23. <property name="ip" value="${xxl.job.executor.ip}" />
  24. <!-- 执行器端口号 -->
  25. <property name="port" value="${xxl.job.executor.port}" />
  26. <property name="appName" value="${xxl.job.executor.appname}" />
  27. <!-- 执行器注册器,默认使用系统提供的 "DbRegistHelper", 推荐将其改为公共的RPC服务 -->
  28. <property name="registHelper" >
  29. <!-- DbRegistHelper, 依赖 "XXL-JOB公共数据源" -->
  30. <bean class="com.xxl.job.core.registry.impl.DbRegistHelper" >
  31. <!-- XXL-JOB公共数据源 -->
  32. <property name="dataSource" ref="xxlJobDataSource" />
  33. </bean>
  34. </property>
  35. </bean>
  36. <!-- ********************************* "XXL-JOB公共数据源" 配置, 仅在启动 "DbRegistHelper" 时才需要, 否则可删除 ********************************* -->
  37. <!-- 配置03、XXL-JOB公共数据源 -->
  38. <bean id="xxlJobDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
  39. <property name="driverClass" value="${xxl.job.db.driverClass}" />
  40. <property name="jdbcUrl" value="${xxl.job.db.url}" />
  41. <property name="user" value="${xxl.job.db.user}" />
  42. <property name="password" value="${xxl.job.db.password}" />
  43. <property name="initialPoolSize" value="3" />
  44. <property name="minPoolSize" value="2" />
  45. <property name="maxPoolSize" value="10" />
  46. <property name="maxIdleTime" value="60" />
  47. <property name="acquireRetryDelay" value="1000" />
  48. <property name="acquireRetryAttempts" value="10" />
  49. <property name="preferredTestQuery" value="SELECT 1" />
  50. </bean>
  51. </beans>