-
1. Re: Configuration files outside of war file
visolvejboss Jun 3, 2006 2:12 AM (in response to rknechtel)Hello,
Create a directory named libinside the war (WEB-INF/lib) and copy the configuration (.properties) files into lib directory. At runtime JBoss will automatically load these files.
Regards,
ViSolve JBoss Team. -
2. Re: Configuration files outside of war file
peterj Jun 5, 2006 10:51 AM (in response to rknechtel)Try this:
String jbossHome = System.getProperties("jboss.home.dir"); Properties props = new Properties().load(new FileInputStream(jbossHome + "/" + propFileName ));
where propFileName is the name of your properties file. -
3. Re: Configuration files outside of war file
peterj Jun 5, 2006 11:06 AM (in response to rknechtel)Oops, change the file name in the last lin to read:
jbossHome + "/configs" + propFileName -
4. Re: Configuration files outside of war file
rknechtel Jun 12, 2006 11:36 AM (in response to rknechtel)
Thanks for the information that works good!
I myself am new to writing web apps for running on JBoss. I have been writing apps on the ATG framework for the last few years.
What I am wondering is does JBoss support the concept of "components", basically you have a Java class and a .properties file for it.
You would have a java class for example:
com.my.classes.MyClass1
and you have a properties file called MyClass1.properties that contains:
$class=com.my.classes.MyClass1
property1=test1
property2=1,2,3,4,5
In the properties file the $class is what links the properties file to the class and the entries "property1" and "property2" line up with "getters/setters" in MyClass1. So when you "load" the class the data is automatically loaded by the "setters" in the class.
I hope this makes sense.
Thanks -
5. Re: Configuration files outside of war file
peterj Jun 12, 2006 1:37 PM (in response to rknechtel)I know that the Spring Framework enables you to do that, though there you have a single configuration file where you specify the property values of all of your beans.