[MAGNOLIA-6634] Make magnolia configuration properties accessible during module-load phase Created: 14/Apr/16  Updated: 09/Feb/17  Resolved: 09/May/16

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 5.4.5
Fix Version/s: 5.4.7, 5.5

Type: Improvement Priority: Neutral
Reporter: Espen Jervidalo Assignee: Espen Jervidalo
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 0.25d
Original Estimate: Not Specified

Issue Links:
dependency
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:
Sprint: Basel 43
Story Points: 3

 Description   

Module descriptors have the ability to define configuration-properties read by the system and exposed by info.magnolia.init.MagnoliaConfigurationProperties.
They get loaded during startup in MagnoliaContextServerListener right after loading the module descriptors from the class path.

By Introducing light-module-descriptors read from the resources-directory defined in magnolia.properties we introduce a circular dependency between module-descriptor loading and properties-loading. Light-modules are dependent on the magnolia configuration properties being present, to obtain the resources-path and the configuration properties are dependent on the module descriptors being present.

There are several approaches to fix this:

  • Lazy-loading the module-descriptor sources
  • Split the DefaultMagnoliaConfigurationProperties into a implementation used during startup and a complete one holding the module descriptor provided source at a later stage.
  • Opening up info.magnolia.init.DefaultMagnoliaConfigurationProperties and allow registering property-sources ad-hoc

As DefaultMagnoliaConfigurationProperties already imposes an order in which the sources are "overriden" I tend to go for the lazy-loading mechanism. It's less invasive than introducing a second, stripped down implementation, which would need to re-order the sources somehow. OTOH the circular dependency conceptually remains.

This topic was discussed in Arch-meeting w/ mgeljic, apchelintcev and pmundt.

Update: Decision was made to go with the second approach. Introduced an info.magnolia.init.InitPhaseMagnoliaConfigurationProperties which loads the properties from info.magnolia.init.MagnoliaInitPaths and info.magnolia.init.MagnoliaPropertiesResolver. Bound to the platform-components. During startup the default implementation will be bound to the system-components by core-module.


Generated at Mon Feb 12 04:16:23 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.