从数据库读取Mule配置 [英] Reading mule config from database
问题描述
是否可以从数据库中读取m子配置文件的路径(文件端点),smtp主机/user/password(smtp端点).我们最终想要提供一个用户界面,用户可以在其中通过屏幕编辑属性.以前使用了常规属性文件方法(键/值)对,但需要进行更改以从数据库中读取这些属性.在此方面的任何帮助将不胜感激.
Is it possible to read mule configuration file path (file endpoints), smtp host /user/password (smtp endpoints) from database.We finally want to provide a User Interface , where the user can edit the properties through the screen.The normal properties file approach (key/Value) pairs was used earlier but needs to change to read these properties from the database.Any help on this will be greatly appreciated.
推荐答案
是的,您可以使用自定义属性提供程序.
Yes, you can use a custom properties provider.
其配置如下所示:
<spring:bean class="org.mule.DatabasePropertiesProvider" id="DatabasePropertiesProvider"/>
<spring:bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<spring:property name="properties">
<spring:bean factory-bean="DatabasePropertiesProvider" factory-method="getProperties" />
</spring:property>
</spring:bean>
DatabasePropertiesProvider的代码很简单:
And the code for DatabasePropertiesProvider is as simple as this:
public class DatabasePropertiesProvider {
public Properties getProperties() throws Exception {
Properties properties = new Properties();
// get properties from the database
return properties;
}
}
这篇关于从数据库读取Mule配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!