Usage of Thread.currentThread().getContextClassLoader().getResourceAsStream(“system.properties”) [closed]

拈花ヽ惹草 提交于 2019-12-13 23:21:22

问题


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?


回答1:


It simply means: Return the property file as InputStream from the ClassLoader the current thread of my application is running from (in loose english).



来源:https://stackoverflow.com/questions/9111484/usage-of-thread-currentthread-getcontextclassloader-getresourceasstreamsys

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!