• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

131
Views
How to read files from resource folder of spring boot application using javascipt

I have some files under resources/test/feature/a.feature , b.feature like that , i want read those files using javascript , and the jacascript file location is resources/test/js/read.js. I am using below code to read

function processFeatures() {
    var features = [];
    var featuresResources = $resources("feature/.*?\\.feature");
    for(var i in featureResources) {
        var feature = JSON.parse($eval(featureResources[i].content))
        features.push(feature);
    }
    return features;
}

This code works when i run the application from intellij, but when i build a jar file and then run the jar file separately that time it fails to read. I printed the featuresResources , that time it giving empty response.

What needs to do in that case.

about 3 years ago · Juan Pablo Isaza
1 answers
Answer question

0

i will suggest you to use java code instead of java script or call code from java script to read file But in your case, its all because of jar file doesn't contain file structure in same manner as you see in your IDE verify your file path in built folder which have final structure which server will run.

about 3 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error