简体   繁体   English

wildfly 8.2读取耳内的属性文件

[英]wildfly 8.2 Read properties files inside ear

I need to read a properties file located inside an ear. 我需要阅读位于耳朵内部的属性文件。 In jboss 5.1 I put the file in the root of the ear and it works, but in wildfly it doesn´t. 在jboss 5.1中,我将该文件放在了耳朵的根部,并且可以使用,但是在wildfly中却没有。 In wildfly, I managed to read the property file outside the ear according to this 在Wildfly中,我设法根据此方法在耳朵外读取属性文件

http://blog.jyore.com/?p=58 http://blog.jyore.com/?p=58

But I haven´t found the way to do the same but with the file inside the ear. 但是我没有找到相同的方法,只是将文件放在耳朵里。 I´ve tried without success putting the file in the METAINF folder, also tried with the "Class-Path: ." 我尝试将文件放在METAINF文件夹中没有成功,也尝试过使用“ Class-Path:”。 in the manifest... 在清单中...

Please any ideas?? 请任何想法? Do I have to put the file in any specific location?? 我必须将文件放在任何特定位置吗?

I found the solution: 我找到了解决方案:

In WildFly 8, to get those properties available in the classpath, package them within your application. 在WildFly 8中,要使这些属性在类路径中可用,请将它们打包在您的应用程序中。 For example, if you are deploying a .war then package those properties in WAR WEB-INF/classes/ folder. 例如,如果要部署.war,则将那些属性打包在WAR WEB-INF / classes /文件夹中。 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. 如果希望这些属性可供.ear中的所有组件访问,则将它们打包在某个.jar的根目录中,然后将该jar放在EAR lib /文件夹中。

https://docs.jboss.org/author/display/WFLY8/How+do+I+migrate+my+application+from+AS5+or+AS6+to+WildFly https://docs.jboss.org/author/display/WFLY8/How+do+I+migrate+my+application+from+AS5+or+AS6+to+WildFly

Thanks for your help 谢谢你的帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM