Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

183
Visualizações
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 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

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 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda