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

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -