feat: Refactor configuration to use Jakarta Config in lyo-server-common#897
Open
berezovskyi wants to merge 3 commits intoeclipse-lyo:masterfrom
Open
Conversation
Introduces a new `lyo-server-common` module to handle configuration property retrieval using the MicroProfile Config (Jakarta Config) API. This replaces the previous manual priority logic (Env > System > Context) with the standard Config precedence (System > Env > Properties) while maintaining a fallback to `ServletContext` init parameters. Changes: - Created `server/lyo-server-common` module. - Added `microprofile-config-api` dependency. - Implemented `LyoAppConfiguration` utility class. - Added unit tests for `LyoAppConfiguration`. - Registered module in parent POMs. This refactoring aligns with Jakarta Config standards and separates server-specific configuration logic from core modules. Co-authored-by: berezovskyi <64734+berezovskyi@users.noreply.github.com>
Contributor
Author
|
@Jad-el-khoury major breaking change when aligning configuration with Jakarta Config is that we will no longer have different prop prefixes. Before:
After:
The breaking change would affect:
We can probably add some legacy fallback to support the legacy prefixes but I would suggest just to drop it. |
Contributor
Author
could now be replaced by @Configuration
@ConfigMapping("eclipse.lyo")
interface LyoAppConfiguration {
@ConfigName("getBaseUrl")
string baseUrl();
@ConfigDefault("8080")
int port();
@ConfigName("cors.friends")
@ConfigConverter(IOThreadsConverter.class)
Set<string> corsFriends();
}or more direct injections of the variables. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces a new
lyo-server-commonmodule to handle configuration property retrieval using the MicroProfile Config (Jakarta Config) API. This replaces the previous manual priority logic (Env > System > Context) with the standard Config precedence (System > Env > Properties) while maintaining a fallback toServletContextinit parameters.Changes:
server/lyo-server-commonmodule.microprofile-config-apidependency.LyoAppConfigurationutility class.LyoAppConfiguration.This refactoring aligns with Jakarta Config standards and separates server-specific configuration logic from core modules.
This PR supersedes #220
Checklist
@oslc-bot /test-allif not sure) or adds unit/integration tests.mvn package org.openrewrite.maven:rewrite-maven-plugin:run spotless:apply -DskipTests -P'!enforcer'if not, commit & push)