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

标签 java jboss jboss5.x jboss7.x jboss6.x

以下是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/

相关文章:

java - 如何在java中打印void

jboss - 混合使用 Spring MVC 和 CDI/JEE6 的最佳方式是什么?

java - JBoss集群: how to find/list all members forming the cluster

java - 外部数据源定义 Tomcat 7

java - 通过连接池将 JMS 消息发送到 JBoss AS 中的远程队列

jboss - 如何在 JBoss 5 中设置自定义 404 页面?

java - JBoss 类加载器顺序 - 另一种理解它的尝试

java - 如何打印我的扑克牌?

java - 如何在 Spring boot 中的 appication.properties 中启用 undertow 日志

java - intelij更新后无法正确导入spring boot项目