I am using a custom directory for properties files located at
${catalina.home}/conf/properties
and in order to add it to the classpath i edited ctalina.properties and added
shared.loader=${catalina.home}/conf/properties
But contents of this directory are not accessible when I try to read them from a listener via:
MyListener.class.getResourceAsStream("/sample.props")开发者_如何学Go
I most probably have misunderstood something here. Any help would be greatly appreciated.
Use
Thread.currentThread().getContextClassLoader()
.getResourceAsStream("/sample.props");
Worked for me with : Thread.currentThread().getContextClassLoader() .getResourceAsStream("sample.props");
精彩评论