Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

307
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda