Thursday, November 3, 2011

Load a Resource from Classpath in Groovy

Lets look at how we can load a resource from classpath in groovy when groovy is used as a part of java application. Put you resource beside the groovy class and do below
ReflectionUtils.getCallingClass(0).getResourceAsStream("testGfile.txt")

No comments:

Post a Comment

Followers