java - Wildfly (8.2.final): How to read a classpath resource? -


i have property file in classpath of application.

src/main/resources/default.properties

in ejb, has singleton , startup annotations, try read file following

thread.currentthead().getcontextloader().getresource("default.properties"); 

this doesn't work. works in glassfish though.

is there way read classpath resource in wildfly?

i found solution.

the call

thread.currentthead().getcontextloader().getresource("default.properties"); 

doesn't work, following works.

inputstream = thread.currentthread ().getcontextclassloader ()                 .getresourceasstream ( "default.properties" ); 

i don't know why so, may help.


Popular posts from this blog