I have an application, which refers to a MY_ PRODUCT_CONF_DIR/mycustom.properties file which has some key value pairs which needs to be external to the ear, war or jars deployed on my WildFly. Earlier in Jboss 6.1.0. we did it in a tricky way. The jboss 6.1.0, have a collection of URLs, visible to CL loading the server.
For example ( https://repository.jboss.org/org/jboss/jbossas/jboss-as-distribution/6.1.0.Final/, refer to jboss-6.1.0.Final-src\main\src\main\java\org\jboss\Main.java )
// Define a Set URLs to have visible to the CL loading the Server
final Set<URL> urls = new HashSet<URL>();
..........
urls.add(new File(MY_ PRODUCT_CONF_DIR)).toURI().toURL()); // I have added the DIR
.........
// Make a ClassLoader to be used in loading the server
final URL[] urlArray = urls.toArray(new URL[]{});
final ClassLoader loadingCl = new URLClassLoader(urlArray, tccl);
// Load the server
server = JBossASServer.class.cast(ServerFactory.createServer(DEFAULT_AS_SERVER_IMPL_CLASS_NAME, loadingCl));
In my code, I read the properties file from ClassLoader
URLClassLoader ucl = (URLClassLoader) loader;
url = ucl.findResource(propertiesResource);
final InputStream inputStream = url.openStream();
..........
So, is there any option to retain this mechanism? Can I add my CONFIG_DIR in the ModuleClassLoader as a URLClassLoader?
Is there any way to keep the properties file external to the ear/jars and module path?