SathishSakthi
SathishSakthi

Reputation: 1

Get the path of file located in src folder of webapplication using spring.

How to get the full path of file located in /src/reportpackage/daysheet.jasper in the spring mvc application?. How to get the string format of the path?

Upvotes: 0

Views: 987

Answers (1)

Shailendra
Shailendra

Reputation: 9102

You need to understand that after the build your file would end up in classpath and what you would be loading through Spring resource loading mechanism is a classpath resource. You can use spring notation for it like this

appContext.getResource("classpath:reportpackage/daysheet.jasper"); 

where appContext is the spring application context which can be autowired in any Spring bean

Upvotes: 3

Related Questions