1
0

spring-schedule.xml 3.2 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. xmlns:task="http://www.springframework.org/schema/task"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans
  7. http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
  8. <context:component-scan base-package="com.kmall.schedule.**">
  9. </context:component-scan>
  10. <import resource="classpath:spring/spring-manager-main.xml"/>
  11. <!--开启这个配置,spring才能识别@Scheduled注解 -->
  12. <task:annotation-driven scheduler="qbScheduler" mode="proxy"/>
  13. <task:scheduler id="qbScheduler" pool-size="10"/>
  14. <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
  15. <property name="dataSource" ref="dataSource" />
  16. <property name="quartzProperties">
  17. <props>
  18. <prop key="org.quartz.scheduler.instanceName">PlatformScheduler</prop>
  19. <prop key="org.quartz.scheduler.instanceId">AUTO</prop>
  20. <!-- 线程池配置 -->
  21. <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
  22. <prop key="org.quartz.threadPool.threadCount">20</prop>
  23. <prop key="org.quartz.threadPool.threadPriority">5</prop>
  24. <!-- JobStore 配置 -->
  25. <prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX</prop>
  26. <!-- 集群配置 -->
  27. <prop key="org.quartz.jobStore.isClustered">true</prop>
  28. <prop key="org.quartz.jobStore.clusterCheckinInterval">15000</prop>
  29. <prop key="org.quartz.jobStore.maxMisfiresToHandleAtATime">1</prop>
  30. <prop key="org.quartz.jobStore.misfireThreshold">12000</prop>
  31. <!-- 表前缀 -->
  32. <prop key="org.quartz.jobStore.tablePrefix">QRTZ_</prop>
  33. <prop key="org.quartz.plugin.shutdownhook.class">org.quartz.plugins.management.ShutdownHookPlugin</prop>
  34. <prop key="org.quartz.plugin.shutdownhook.cleanShutdown">true</prop>
  35. <prop key="org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread">true</prop>
  36. </props>
  37. </property>
  38. <property name="schedulerName" value="PlatformScheduler" />
  39. <!--延时启动 -->
  40. <property name="startupDelay" value="30" />
  41. <property name="applicationContextSchedulerContextKey" value="applicationContextKey" />
  42. <!--可选,QuartzScheduler 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了 -->
  43. <property name="overwriteExistingJobs" value="true" />
  44. <!-- 设置自动启动 默认为true -->
  45. <property name="autoStartup" value="true" />
  46. </bean>
  47. </beans>