【发布时间】:2012-01-30 19:33:57
【问题描述】:
我正在设置一个 Mule 应用程序,我想在其中使用 Spring bean 来连接 EHCache 和 JDBC 连接。我不想将配置信息放在我创建的每个 Mule 应用程序中,而是想使用一个位于 $mule_home/conf 的属性文件。
我知道如何使用 Mule 表达式来访问 Mule 主目录 (#[mule:context.homeDir]),但是当我尝试将该表达式放入我的 context.xml 文件中时,我将其链接到我的 mule 应用程序配置中,然后启动服务器,我得到一个
java.io.FileNotFoundException: #[mule:context.homeDir]\conf\jdbc.properties (The system cannot find the path specified)
即使我在 mule 配置中创建了一个单独的属性,${homeDir} 的值为 #[mule:context.homeDir] 它也会给我同样的错误,除了 ${homeDir} 无法解决。
我已经打开日志,可以看到它连接了属性${homeDir},但似乎属性占位符不想解决它。我已经尝试过并使用 PropertyPlaceholderConfigurer 类的原始 bean:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>file:#[mule:context.homeDir]/conf/jdbc.properties</value>
<value>file:#[mule:context.homeDir]/conf/standalone-ehcache.conf</value>
<value>classpath:gateway.properties</value>
</list>
</property>
</bean>
【问题讨论】: