ule子3.3自动重新加载属性 [英] mule 3.3 auto reload properties

查看:92
本文介绍了ule子3.3自动重新加载属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发在mule-enterprise-3.3.2上运行的应用程序.出于配置和调整的目的,我们在Spring上下文(Spring 3.1)管理的.properties文件中使用以下行放置了许多参数:

we are developing an application running on mule-enterprise-3.3.2. For the configuration and tweaking purposes we have many parameters placed in .properties files managed by the spring context (Spring 3.1) using this line:

<context:property-placeholder location="classpath:my-config.properties" />

如何在不重新启动服务器的情况下自动重新加载更改的属性?

How can we auto reload the properties on changes without doing a server restart?

有什么建议吗?

(注意:我不确定,m子是否通常可以在运行时处理参数更改.)

(Note: I'm not sure, if mule can handle changing of parameter at runtime in general.)

推荐答案

属性在初始化时在XML配置文件(Mule或Spring)中解析,因此以后不能更改它们.

Properties are resolved in XML configuration files (Mule or Spring) at initialization time, so you can't change them later on.

一种执行所需操作的方法是在实现Java接口的Groovy bean中定义配置值,然后使用Spring从文件系统中加载它. Spring支持热重装Groovy Bean,因此可以在运行时重载属性.

One approach to do what you want to do is to define the configuration values in a Groovy bean that implements a Java interface and use Spring to load it from the file system. Spring supports hot reloading Groovy beans so the properties would be reloaded at runtime.

然后将此配置bean注入需要支持运行时配置更改的对象中.如果您需要以更静态的方式从此bean中获取值,请使用SpEL从XML配置中注入值.

Then inject this configuration bean in the objects that need to support runtime configuration changes. If you need values from this bean in a more static manner, use SpEL to inject the values from the XML configuration.

这篇关于ule子3.3自动重新加载属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆