美文网首页
Quartz | Spring Boot整合Quartz

Quartz | Spring Boot整合Quartz

作者: 冯文议 | 来源:发表于2018-07-25 19:02 被阅读120次

引言

依赖

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-quartz</artifactId>
    </dependency>
</dependencies>

配置

可在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

      本文链接:https://www.haomeiwen.com/subject/kmjmmftx.html