Java – How to override quartz property values

How to override quartz property values… here is a solution to the problem.

How to override quartz property values

I have a spring boot application with an application.properties file. The project relies on third-party libraries, in my case it is:

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

The library has its quartz.properties file and configuration. I want to override some values such as:

org.quartz.threadPool.threadCount:10

There are more threads.

How do I use my own properties file and/or environment variables?

Solution

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

Spring :
quartz :
Characteristic:
org.quartz.threadPool.threadCount:10

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

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

Related Problems and Solutions