I am trying to read values from a json file which I have placed in my resource folder directly. I am able to run it successfully without any error in bootrun & also build successfully within IntelliJ with the below code
 try (FileInputStream serviceAccountStream=new FileInputStream("src/main/resources/mockData.json");) {
            credentials = ServiceAccountCredentials.fromStream(serviceAccountStream);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        catch (Exception e){
            System.out.println("Issue with the credential reader"+e.getMessage());
        }
However when a JAR is created with the above, I am getting exception as fileNotFound
java -jar app-0.0.1-SNAPSHOT-plain.jar
java.io.FileNotFoundException: src\main\resources\mockData.json (The system cannot find the path specified)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at com.exampleBQ.demoBQ.BQConfig.getBQBean(BQConfig.java:31)
    ```
Could someone plz help on how to read the file as FileInputStream  within Jar
 
     
    