Arvind Sridharan
Arvind Sridharan

Reputation: 4045

how do i get values from a properties file in quartz scheduler?

I'm using spring 2.0.6 and quartz 1.5.2 in a java based webapp. Want to know how to configure my applicationContext-quartz.xml such that i can read values from a properties file. i.e. I would like to have my file read

<property name="imageFolder" value="${config.imageFolder}" />
<property name="rawImageFolder" value="${config.rawImageFolder}" />
<property name="imageOutputFolder" value="${config.imageOutputFolder}" />

instead of

<property name="imageFolder" value="/path/to/dir1" />
<property name="rawImageFolder" value="/path/to/dir2" />
<property name="imageOutputFolder" value="/path/to/dir3" />

Upvotes: 0

Views: 2288

Answers (1)

Sean Patrick Floyd
Sean Patrick Floyd

Reputation: 298898

Use the PropertyPlaceholderConfigurer mechanism:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <!-- change this to your property location -->
        <value>classpath:quartz.properties</value>
    </property>
</bean>

Upvotes: 1

Related Questions