Issue
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?
Solution
Good day,
You have to read a file through ClassPathResource, here is a good example - https://www.baeldung.com/spring-classpath-file-access
Answered By - Alexander Makarov
Answer Checked By - Marilyn (JavaFixing Volunteer)