1

I am trying to read and write files directly in my source resources folder.

Watching other questions like Spring Boot access static resources missing scr/main/resources I have been able to get the outputfolder by using ClassPathResource:

out/resources/sql

Is it possible to get the real resources folder?

/src/test/resources/sql

(I need it for test, thats why I wrote /test/, but I assume that solution for /main/ would also help me)

Note

I understand that for reading it's not a problem, since in runtime I will have anything under src/test/resources. However, for writing it will get overriden everytime I compile the code

Mayday
  • 4,680
  • 5
  • 24
  • 58

1 Answers1

0

Does it have to be /src/test/resources/sql? I wanted to persist data across server restarts and ended up configuring it to use a MySQL database instead. That way, I had access to it even when the Tomcat server that Spring runs on was stopped, and I could read from that same MySQL database when it's restarted.

I answered my own question here with the steps to take, based on an answer here. Does that help?