Thread.currentThread()。getContextClassLoader()。getResourceAsStream(“ system.properties”)的用法 [英] Usage of Thread.currentThread().getContextClassLoader().getResourceAsStream("system.properties")
本文介绍了Thread.currentThread()。getContextClassLoader()。getResourceAsStream(“ system.properties”)的用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的Web应用程序中,我已将system.properties文件保留在web-inf / classes文件夹中。
In my web application, I have kept system.properties file in the web-inf/classes folder.
要使用该代码来访问该文件的输入流以下代码段:
To Access that file's inputstream, I am using the code snippet below:
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(SYSTEM_PROPERTIES_FILE)
还有其他方法可以访问该文件吗?
Is there any other way to access that file?
推荐答案
它的简单含义是:从当前线程 ClassLoader
返回属性文件为 InputStream
我的应用程序的运行语言是(用宽松的英语)。
It simply means: Return the property file as InputStream
from the ClassLoader
the current thread of my application is running from (in loose english).
这篇关于Thread.currentThread()。getContextClassLoader()。getResourceAsStream(“ system.properties”)的用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文