简体   繁体   中英

Are Quartz's configuration parameters externalizable outside of the default properties file?

Quartz has a properties file which it reads configuration information from usually named quartz.properties. I am using Quartz in an already existing Java/Spring application which lets end users specify configuration parameters via the use of a JSON file. I am wondering can I 'elevate' or 'lift' some of the parameters Quartz is reading from the quartz.properties configuration file in my application to my JSON configuration file (which is the user's configuration interface) so the user can enter some parameters that can then be passed to Quartz (via or not via) it's own configuration file, the aforementioned quartz.properties file? If so, what would be a clean way to do this?

I think the best way would be to initialize the scheduler factory with a Properties-Object before creating a Scheduler.

Ie

// implement the method createPropertiesFromJSON().
// It should read your JSON file (i.e. your configuration) and
// transform it to a Properties object.
Properties propertiesFromJson = createPropertiesFromJSON();
StdSchedulerFactory.initialize(propertiesFromJson);
Scheduler scheduler = StdSchedulerFactory.getScheduler();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM