Note: The read path cannot be this path, because this file is not run after the SRC path, but under classes
However, this is also not possible because the file startup starts from the virtual machine and does not have this path under the virtual machine unless the classes file containing the properties is copied to the virtual machine path
So, using ServletContext to read
Usually in the project, we use ServletContext to get the resource path, and then read the resource file in the traditional way.
In this, is the template code that gets the content with ServletContext, is fixed
Class loader: Not suitable for large files because the class file is too large to load directly into the virtual machine, which can lead to memory overflow
And, with the ClassLoader, the class is loaded only once, so the updated data cannot be obtained, so the resource file location is usually obtained in the same way that the class is loaded, and then the updated data is obtained in the traditional way.
ServletContext reading a resource file in a web App