[jboss-user] [EJB/JBoss] - Re: how can i store config file
jaikiran
do-not-reply at jboss.com
Thu Sep 21 10:53:03 EDT 2006
You need not write the code of instantiating the singleton in the ejbCreate or any other specific method. You can do something similar to:
MyEJB implements SessionBean {
|
| public void someMethod() {
|
| //do some logic
| .....
| //at this point, i need the value for a property. So do the following
| ConfigMgr.getInstance().getPropertyValue("someProperty");
|
| }
|
| }
|
| ConfigMgr {
|
|
| private static ConfigMgr configMgr;
|
| private Properties properties;
|
| private ConfigMgr() {
|
| //load the properties file
| properties = someCodeToLoadPropertiesFile();
| }
| public synchronized static getInstance() {
|
| if (configMgr == null) {
| configMgr = new ConfigMgr();
| }
| return configMgr;
| }
|
|
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3973307#3973307
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3973307
More information about the jboss-user
mailing list