xxl-job

applicationcontext-xxl-job.xml 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. <!-- ********************************* 基础配置 ********************************* -->
  10. <!-- 配置01、JobHandler 扫描路径 -->
  11. <context:component-scan base-package="com.xxl.job.executor.service.jobhandler" />
  12. <!-- 配置02、执行器 -->
  13. <bean id="xxlJobExecutor" class="com.xxl.job.core.executor.jetty.XxlJobExecutor" init-method="start" destroy-method="destroy" >
  14. <!-- 执行器端口号 -->
  15. <property name="port" value="9999" />
  16. <property name="appName" value="xxl-job-executor-example" />
  17. <!-- 执行器注册器,默认使用系统提供的 "DbRegistHelper", 推荐将其改为公共的RPC服务 -->
  18. <property name="registHelper" >
  19. <!-- DbRegistHelper, 依赖 "XXL-JOB公共数据源" -->
  20. <bean class="com.xxl.job.core.registry.impl.DbRegistHelper" >
  21. <!-- XXL-JOB公共数据源 -->
  22. <property name="dataSource" ref="dataSource" />
  23. </bean>
  24. </property>
  25. </bean>
  26. <!-- ********************************* "GlueFactory" 配置, 仅在启动 "GLUE模式任务" 时才需要, 否则可删除 ********************************* -->
  27. <!-- 配置03、GlueFactory -->
  28. <bean id="glueFactory" class="com.xxl.job.core.glue.GlueFactory">
  29. <!-- GLUE任务示例缓存失效时间, 单位/ms -->
  30. <property name="cacheTimeout" value="10000" />
  31. <!-- GLUE源码加载器,默认使用系统提供的 "DbGlueLoader", 推荐将其改为公共的RPC服务 -->
  32. <property name="glueLoader" >
  33. <!-- DbGlueLoader, 依赖 "XXL-JOB公共数据源" -->
  34. <bean class="com.xxl.job.core.glue.loader.impl.DbGlueLoader" >
  35. <!-- XXL-JOB公共数据源 -->
  36. <property name="dataSource" ref="dataSource" />
  37. </bean>
  38. </property>
  39. </bean>
  40. <!-- ********************************* "XXL-JOB公共数据源" 配置, 仅在启动 "DbRegistHelper" 或 "DbGlueLoader" 时才需要, 否则可删除 ********************************* -->
  41. <!-- 配置04、XXL-JOB公共数据源 -->
  42. <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
  43. <property name="driverClass" value="${c3p0.driverClass}" />
  44. <property name="jdbcUrl" value="${c3p0.url}" />
  45. <property name="user" value="${c3p0.user}" />
  46. <property name="password" value="${c3p0.password}" />
  47. <property name="initialPoolSize" value="3" />
  48. <property name="minPoolSize" value="2" />
  49. <property name="maxPoolSize" value="10" />
  50. <property name="maxIdleTime" value="60" />
  51. <property name="acquireRetryDelay" value="1000" />
  52. <property name="acquireRetryAttempts" value="10" />
  53. <property name="preferredTestQuery" value="SELECT 1" />
  54. </bean>
  55. <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  56. <property name="fileEncoding" value="utf-8" />
  57. <property name="location">
  58. <value>classpath:jdbc.properties</value>
  59. </property>
  60. </bean>
  61. </beans>