如果要从配置目录(例如
$WILDFLY_HOME/standalone/configuration或
domain/configuration)中显式读取文件,则有一个系统属性,其中包含路径。只需
System.getProperty("jboss.server.config.dir");添加您的文件名并将其附加到该文件名即可。但是,您不会将其作为资源阅读,所以…
String fileName = System.getProperty("jboss.server.config.dir") + "/my.properties";try(FileInputStream fis = new FileInputStream(fileName)) { properties.load(fis);}然后将为您加载文件。
另外,由于WildFly不再提供OSGi支持,因此我不知道创建OSGi模块将如何为您提供帮助。



