I have a problem regarding reading my property, I do it like this:
FileInputStream fis; Properties properties = new Properties(System.getProperties()); fis = new FileInputStream(Objects.requireNonNull(this.getClass().getClassLoader() .getResource("config.properties")).getFile()); properties.load(fis);
on the local machine, this works well, but when I deploy my application there is a problem:
Caused by: java.io.FileNotFoundException: /content/MyProject-1.0-SNAPSHOT.war/WEB-INF/classes/config.properties (No such file or directory)
When I try to see if there is a file I need, I find it, but java can’t find it.
Here is an approximate structure of my project:
src/main/java/entities/PropertyInit.java – from here I try to read properties
src/main/resources/config.properties – here is the path to my property