在域模式Wildfly10中共享属性文件

hap*_*ppy 5 jboss jboss7.x wildfly wildfly-10

在域模式下,我可以使用属性文件作为模块,但问题是如果文件中有任何修改,那么我需要为域中的所有从属文件执行此操作.我想集中文件,以便在某一点上我可以改变,它将反映在所有奴隶上.

我知道在domain.xml中我们可以配置全局级系统属性,但我有大约25个属性文件.

那么有没有办法集中文件?

myjar.jar
-->package
   --> class
-->properties
   -->xml files
Run Code Online (Sandbox Code Playgroud)

myjar.jar是一个存档的jar文件,用于获取xml文件

 URL url = Thread.currentThread().getContextClassLoader().getResource("./properties");

File queryFolder = new File(url.getFile());

for (File fileName : queryFolder.listFiles())  // null pointer exception
{
    if (fileName.getName().toUpperCase().endsWith("XML"))
    {   
            saxParser.parse(fileName, this);
     }
}
Run Code Online (Sandbox Code Playgroud)

这不起作用.

试过这个

如何列出JAR文件中的文件?

并面临下面链接中给出的相同问题

使用java nio Paths时未安装JBoss wildfly 8.x Provider"vfs"

URL w_url = mmyClass.class.getProtectionDomain().getCodeSource().getLocation();
            JarEntry w_ze = null;
            LOGGER.info("Jar******************" + w_url.toString());
            if (w_url.toString().endsWith(".jar")) 
            {
                try (JarInputStream jar = new JarInputStream(w_url.openStream())) 
                {
                    while ((w_ze = jar.getNextJarEntry()) != null)
                    {
                        LOGGER.info("Name *******" + w_ze.getName());
                    }
                }
                catch(Exception e)
                {

                }
            }
Run Code Online (Sandbox Code Playgroud)

hap*_*ppy 1

在 war 文件中添加了属性文件夹,并在 war 文件的 servlet 中使用以下代码获取分解的文件夹路径。

config.getServletContext().getRealPath("/");
Run Code Online (Sandbox Code Playgroud)

这给出了文件夹的 vfs 路径。

并在中配置相同

System.setProperty("REALPATH", config.getServletContext().getRealPath("/"));
Run Code Online (Sandbox Code Playgroud)

并在 jar 文件中使用相同的内容。