Quartz | Spring Boot整合Quartz

引言

依赖


    
        org.springframework.boot
        spring-boot-starter-quartz
    

配置

可在application.yml 或者 application.properties中:

spring:
  quartz:
    #相关属性配置
    properties:
      org:
        quartz:
          scheduler:
            instanceName: clusteredScheduler
            instanceId: AUTO
#          jobStore:
#            class: org.quartz.impl.jdbcjobstore.JobStoreTX
#            driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#            tablePrefix: QRTZ_
#            isClustered: true
#            clusterCheckinInterval: 10000
#            useProperties: false
          threadPool:
            class: org.quartz.simpl.SimpleThreadPool
            threadCount: 10
            threadPriority: 5
            threadsInheritContextClassLoaderOfInitializingThread: true
    #数据库方式
    #job-store-type: jdbc
    #初始化表结构
    #jdbc:
      #initialize-schema: never

controller

    @Autowired
    private Scheduler scheduler;

你可能感兴趣的:(Quartz | Spring Boot整合Quartz)