How relative paths to .war work?

I have a Spring Boot app that I tried deploying to a .war to run it from a Tomcat server.

Before this I was deploying to a executable .jar and everything worked perfectly.

In the app I need to read a .json file and also read a directory, their locations are given as relative. When deploying to .jar I would have the file in the same folder as the .jar. I would access it as: ./branchMap.json. The directory would also be in the same folder as the jar and I would access it as: ./patches.

Now when I am deploying to .war I place the app in webapps in Tomcat and I place the json file and the folder also in webapps. When I run the app it is able to read the json file, but it is not able to read the /patches folder.

Why is this happening? I have seen that Tomcat tries to load the /patches folder as a app, in is listed in the tomcat manager. How does this interfere with the app trying to read access that folder? Is there something different in the way that a app deployed to war accesses relative paths?

Read the paches folder location from properties file and in the property file you can mention the full path of the patches folder.