Reputation: 7484
I have a spring bean definition as:
<bean class="...">
<property name="myFile" value="full\path\to\src\main\resources\a\b\myfile.dat"></property>
</bean>
This works fine. But its full path. I intend it to be like:
value="a\b\myfile.dat"
While trying to do so, I get FilesNotFoundException.
How to do it correctly?
Upvotes: 0
Views: 430
Reputation: 886
Good day,
You have to read a file through ClassPathResource, here is a good example - https://www.baeldung.com/spring-classpath-file-access
Upvotes: 1