I'm attempting to specify my quartz properties file in gradle. From a 'config' directory rather than from resources.
String quartzProperties = System.properties['org.quartz.properties'] ?: "file:config/local/quartz.properties"
System.setProperty("org.quartz.properties", quartzProperties)
The output from
(System.properties).each {
println "Prop ${it}"
}
or the properties task, is
Prop quartz.properties=file:config/local/quartz.properties
The output from quartz is
PropertiesFactoryBean --- Loading properties file from class path resource [quartz.properties]
SchedulerConfig$$EnhancerB --- Cannot load quartz.properties.
The symptom of it not being set is that I am getting the wrong sql dialect so the application gives a database error on load.
I had the same question and looking at your code, using file:config/local/quartz.properties
was wrong most likely. The official docs really only put a path into that property, without any URI-prefix or whatsoever. That prefix most likely made the path invalid and Quartz was unable to find it. The following is an example from GitHub :
workdir=`dirname $0`
workdir=`cd ${workdir} && pwd`
QUARTZ=${workdir}/../..
[...]
# Set the name and location of the quartz.properties file
QUARTZ_PROPS="-Dorg.quartz.properties=${workdir}/quartz.properties"
At least one available factory really only uses a file as well:
String requestedFile = System.getProperty(PROPERTIES_FILE);
String propFileName = requestedFile != null ? requestedFile
: "quartz.properties";
File propFile = new File(propFileName);
Besides that, at least nowadays some factories exist which support providing settings directly:
StdSchedulerFactory(Properties props)
Create a StdSchedulerFactory that has been initialized via initialize(Properties).
initialize(InputStream propertiesStream)
Initialize the SchedulerFactory with the contents of the Properties file opened with the given InputStream.
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.