java - How to read a text file from spring xd module jar -
i have spring xd module, packaged jar file. want put text file in resources , read data file when module launched.
what have tried far
thread.currentthread().getclass().getclassloader().getresource("file") thread.currentthread().getcontextclassloader().getresource("file")
but didn't work. how read text files module jar?
i have figured out.
you add member tasklet class
@autowire resourceloader resourceloader;
and when need load file jar this.
inputstream stream = resourceloader.getresource("/path/inside/jar/file").getinputstream();
dont' forget close stream :)
Comments
Post a Comment