mule配置中的属性占位符从一个文件解析而不是从另一个文件解析 [英] property placeholder in mule configuration is resolved from one file but not from the other

查看:100
本文介绍了mule配置中的属性占位符从一个文件解析而不是从另一个文件解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个奇怪的问题。
我有一个mule配置文件。有没有什么真正令人兴奋的和工作正常。至少它工作...

I've encountered with a weird issue. I have a mule configuration file. There is Nothing really exciting in it and works fine. At least it worked...

当我开始将配置参数放入几个属性文件时,问题开始。

The problems started when I started to put the configuration parameters into several properties files. If I define a property in one file it gets resolved, but nothing from the other file.

没有错误消息指示读取文件失败或任何...

No error message indicates that reading the file failed or anything...

我的场景告诉我这和配置文件是由org.mule.config.spring.SpringXmlConfigurationBuilder ...读取的事实有关...

My scenes tells me that this has something to do with the fact that the config files are read by org.mule.config.spring.SpringXmlConfigurationBuilder...

有没有人有类似的问题?

Did anyone had similar issue? or has anyone any idea what the heck is going on?

推荐答案

感谢各位。

所以神秘的问题解决了。在我的集成测试中,我需要一个启动hornetq / mule服务器对。对于测试,我想注入所有可能从通常的spring XML配置的对象。
所以我在spring XML配置文件中定义了我的MuleServer bean,并使用了构造函数,它将mule的配置文件作为String数组。我不知道(或没有想到)MuleServer类创建自己的应用程序上下文...

So the mysterious issue is solved. In my integration test I needed a started hornetq/mule server pair. For the test I wanted to inject all object that possible from usual spring XML configuration. So I defined my MuleServer bean in spring XML config file and used the constructor that takes mule's config files as an array of String. What I wasn't aware of (or not thought through) that MuleServer class creates its own application context...

所以在我的测试应用程序上下文中我实例化一个对象创建自己的应用程序上下文...

So in my tests application context I instantiated an object that creates its own application context...

由于属性占位符是某种特殊的bean,必须在所有其他bean之前进行初始化,导致上述奇怪的行为。

Since Property placeholders are some sort of special beans and must be initialized before all other beans this caused the above weird behavior.

解决方案是我用新的关键字实例化MuleServer,就像我在测试setUp方法中的旧日子。

The solution was that I instantiated MuleServer with new keyword as in the old days in my tests setUp method.

对我来说。

这篇关于mule配置中的属性占位符从一个文件解析而不是从另一个文件解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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