gpt4 book ai didi

java - JBoss7 如何添加外部资源文件夹?

转载 作者:搜寻专家 更新时间:2023-10-31 20:29:59 24 4
gpt4 key购买 nike

以下是JBossAS 7.1 Developer Guider:

Change ResourceBundle location In previous versions of AS, the JBOSS_HOME/server//conf/ was available in the classpath. Hence the properties files in that location were available in the classpath of the application.

In AS7, to get those properties available in the classpath, package them within your application. For example, if you are deploying a .war then package those properties in WAR WEB-INF/classes/ folder. If you want those properties accessible to all components in a .ear, then package them at the root of some .jar and place that jar in EAR lib/ folder.

但是如果资源文件太多,这种方法就不太好了,我们不能把所有的资源文件都打包到jar或者ear中。

对于新的类加载方式——module。我尝试以下方法:

create module.xml file .. you will chose module name... for instnace custom.myconfig

<resources>
<resource-root path="."/>
<!-- Insert resources here -->
</resources>

<dependencies>
</dependencies> </module> In your jboss-deployment-structure.xml include this module to your app
<jboss-deployment-structure>
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<dependencies>
<module name="custom.myconfig/>
</dependencies>
<resources>
</resources>
</deployment>

<sub-deployment name="My_WAR.war">
<dependencies>
<module name="custom.myconfig" />
</dependencies>
</sub-deployment>

https://community.jboss.org/message/723631

但是我发现你不能设置路径的绝对路径,比如:[resource-root path=""C:\resourcefolder"].

这意味着您还需要包含 JBossAS 7 上的所有资源文件。

在JBossAS 5.x-6.x 上很简单,只需要在类路径中添加“C:\resourcefolder”这样的文件夹路径就可以了。但这在 JBossAS7 上就像一个不可能完成的任务。

最佳答案

最后,我将资源文件夹软链接(soft link)到 JBossAS 7.....

Linux:

In -s

window :

MKLINK /D

Junction.exe

关于java - JBoss7 如何添加外部资源文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10911016/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com