|
Walden, I load them from the classpath. The simplest way (with Tomcat) is to put the properties files in the WEB-INF/classes directory. When I deploy to a Web archive, I use ant to pull the appropriate configuration from multiple versions. In some cases, I fall back to the system properties if a specific file is not found. Here is some code to look at the classpath: public static final String MAILER_PROPERTIES = "com/somecompany/config/Mailer.properties"; private static Properties properties; static { // If properties file found, use it for user/password InputStream inputStream = Thread.currentThread() .getContextClassLoader().getResourceAsStream(MAILER_PROPERTIES); // Load Properties File if (inputStream == null) { properties = System.getProperties(); // Assume system properties } else { try { properties = new Properties(); properties.load(inputStream); } catch (Exception e) { log.error("Error loading Mailer.properties.", e); throw new MailerRuntimeException(e); } } } >>> WaldenL@xxxxxxxxxxxxxxx 11/01/05 10:01 AM >>> All, If I understand the concept correctly, one should put their "softcoded" things into a properties file. This could be connection strings (if you're not using WebSphere data sources), Web Services addresses, URLs you access that are different between test and production, etc. Now, the properties file is "wrapped" into the WAR file that's deployed to websphere. So, once deployed you go into the properties file and make your changes? Am I good so far? If so, what's the process for deploying updates? If I re-deploy the WAR file then I'll overwrite the properties file, so I have to make my changes again? Is there a way to exclude the properties file from the WAR and have WS leave it on the server? -Walden
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.