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

308
Visualizações
Serving static resources with Micronaut, with directory hierarchy

Given the following configuration in application.yml, I would expect to be able to serve files from both of the following paths:

  • http://localhost/static/image.png (from /root/static/image.png)
  • http://localhost/static/folder/image.png (from /root/static/folder/image.png)

However, only the first path works. The second returns a 200 status code with the following in the response body: {"message":"Page Not Found","_links":{"self":{"href":"/static/folder/image.png","templated":false}}}

The issue seems to be the extra subdirectory, but I would have expected the **/* in the mapping field to allow for subdirectories. FWIW, I get the same error if I request a resource that does not exist.

This is on Micronaut 2.

micronaut:
  application:
    name: api
  router:
    static-resources:
      default:
        paths: file:/root/static
        mapping: /static/**/*
        enabled: true

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The paths key should be a list (as hinted by the plural):

  router:
    static-resources:
      default:
        paths: 
          - file:/root/static
        mapping: /static/**/*
        enabled: true
over 4 years ago · Santiago Trujillo 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