6.16 Serving Static Resources

Static resource resolution is enabled by default. Micronaut supports resolving resources from the classpath or the file system.

See the information below for available configuration options:

🔗

Table 1. Configuration Properties for StaticResourceConfiguration
PropertyTypeDescription

micronaut.router.static-resources..enabled

boolean

Sets whether this specific mapping is enabled. Default value (true).

micronaut.router.static-resources..paths

java.util.List

A list of paths either starting with classpath: or file:. You can serve files from anywhere on disk or the classpath. For example to serve static resources from src/main/resources/public, you would use classpath:public as the path.

micronaut.router.static-resources..mapping

java.lang.String

The path resources should be served from. Uses ant path matching. Default value (“/*“).