MicroProfile Config

MicroProfile Config defines a set of supported default ConfigSources for environment variables, system properties, and META-INF/microprofile-config.properties files on the classpath with specific ordinals.

SmallRye Config library

Magnolia can scan more locations for configuration properties files and uses the SmallRye Config library for implementation. It supports passing such locations through the magnolia.config.locations configuration property, which is defined as a system or environment property.

  • Mac and Linux

  • Windows

Java system property from command line
-Dmagnolia.config.locations=../WEB-INF/config/default/microprofile-config.yaml

To specify the path on Windows, write it as a URI, as shown below.

Java system property from command line
-Dmagnolia.config.locations=file:///c:/magnolia/.../WEB-INF/config/default/microprofile-config.yaml

You can also specify locations via magnolia.properties.

magnolia.properties file
magnolia.config.locations=${magnolia.home}/WEB-INF/config/magnoliaAuthor/microprofile-config.properties

This enables developers to build containerized images of Magnolia once, and deploy anywhere; for example, when using Docker bind mounts or Kubernetes ConfigMaps.

Raw view of MicroProfile Config values

To see exactly where a specific MicroProfile Config property is coming from, what precedence and values it has, see the Config info tab in the About app.

To locate a property, start typing its name in the Configuration column`s filter field:

Viewing MicroProfile Config properties in the About app

Property injection

While Magnolia supports injecting @ConfigProperty fields into managed components, it’s not fully interoperable with the CDI specification.

Magnolia uses Google Guice for dependency injection.
Related topics
Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules