如何从石英调度程序中的属性文件中获取值?

时间:2011-09-02 15:16:02

标签: java spring quartz-scheduler

我在基于java的webapp中使用spring 2.0.6和quartz 1.5.2。想知道如何配置我的applicationContext-quartz.xml,以便我可以从属性文件中读取值。即我想阅读我的文件

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

而不是

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

1 个答案:

答案 0 :(得分:1)

使用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>