如何覆盖石英的属性值 [英] How to override quartz's property value

查看:46
本文介绍了如何覆盖石英的属性值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有 application.properties 文件的 Spring Boot 应用程序.该项目依赖于第三方库,在我的情况下是:

I have spring boot application with it's application.properties file. The project has a dependency on third-party library, in my case its:

<dependency>
    <groupId>org.quartz-scheduler</groupId>
    <artifactId>quartz</artifactId>
    <version>2.3.0</version>
</dependency>

该库具有带有配置的 quartz.properties 文件.我想覆盖一些值,例如:

The library has its quartz.properties file with configs. I would like to override some values, e.g.:

org.quartz.threadPool.threadCount:10

有另一个线程数.

如何使用我自己的属性文件和/或环境变量来实现?

How can I do it using my own properties file and/or environment variable?

推荐答案

使用 Spring boot 2 应用程序(假设您有 spring-boot-starter-quartz ),您可以直接指定属性:

With Spring boot 2 application ( assuming you have the spring-boot-starter-quartz ), you can just specify the properties directly:

春天:石英:特性:org.quartz.threadPool.threadCount:10

spring: quartz: properties: org.quartz.threadPool.threadCount:10

https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-quartz.html

Quartz Scheduler 配置可以通过使用 Quartz 配置属性 ()spring.quartz.properties.*) 和 SchedulerFactoryBeanCustomizer bean 进行自定义,这允许编程性的 SchedulerFactoryBean 自定义.

Quartz Scheduler configuration can be customized by using Quartz configuration properties ()spring.quartz.properties.*) and SchedulerFactoryBeanCustomizer beans, which allow programmatic SchedulerFactoryBean customization.

这篇关于如何覆盖石英的属性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆