将外部属性文件加载到在WebLogic 11上运行的EJB 3应用程序中 [英] Load external properties files into EJB 3 app running on WebLogic 11
问题描述
我正在研究从EAR 3和将EAR文件部署到WebLogic的EJB 3应用程序加载外部属性文件的最佳方法。
Am researching the best way to load external properties files from and EJB 3 app whose EAR file is deployed to WebLogic.
我在考虑使用初始化servlet,但是我在某个地方读取它会太慢(例如,我的消息处理程序可能会在init servlet运行之前从我的JMS队列接收到一条消息)。
Was thinking about using an init servlet but I read somewhere that it would be too slow (e.g. my message handler might receive a message from my JMS queue before the init servlet runs).
假设我有多个属性文件或一个文件在这里:
Suppose I have multiple property files or one file here:
〜/ opt / conf /
~/opt/conf/
到目前为止,我认为这是最好的解决方案是通过使用Web Logic应用程序生命周期事件来进行的,该事件在预启动期间要读取属性文件的代码:
So far, I feel that the best possible solution is by using a Web Logic application lifecycle event where the code to read the properties files during pre-start:
import weblogic.application.ApplicationLifecycleListener;
import weblogic.application.ApplicationLifecycleEvent;
public class MyListener extends ApplicationLifecycleListener {
public void preStart(ApplicationLifecycleEvent evt) {
// Load properties files
}
}
请参阅: http://download.oracle.com/docs/cd/E13222_01/wls/docs90/programming/lifecycle.html
如果服务器已经在运行,会发生什么情况?启动后会是可行的解决方案吗?
What would happen if the server is already running, would post start be a viable solution?
有人能想到其他更好的方法吗?
Can anyone think of any alternative ways that are better?
推荐答案
弄清楚了...
请参阅相应的相关文章堆栈溢出。
See the corresponding / related post on Stack Overflow.
这篇关于将外部属性文件加载到在WebLogic 11上运行的EJB 3应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!