Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default values even outside of CDI #533

Open
1 of 4 tasks
dmlloyd opened this issue Mar 6, 2020 · 2 comments
Open
1 of 4 tasks

Default values even outside of CDI #533

dmlloyd opened this issue Mar 6, 2020 · 2 comments
Labels
use case 💡 An issue which illustrates a desired use case for the specification
Milestone

Comments

@dmlloyd
Copy link
Contributor

dmlloyd commented Mar 6, 2020

Description

Sometimes a property needs to have a value that is returned if no configuration source has explicitly defined what the value of the property should be. This is commonly referred to as a "default value".

As a:

  • Application user/user of the configuration itself
  • API user (application developer)
  • SPI user (container or runtime developer)
  • Specification implementer

...I need to be able to:

  • Be able to specify the default value for a configuration property relating to my application which is used in any API usage context (i.e. not just in CDI).
  • Receive the default value for a configuration property when no configuration source specifies a value for the property and when no configuration source explicitly clears the property.

...which enables me to:

Have a similar experience between CDI and the programmatic API; have a consistent result even if I switch between APIs.

Related to #475.

@dmlloyd dmlloyd added the use case 💡 An issue which illustrates a desired use case for the specification label Mar 6, 2020
@Emily-Jiang
Copy link
Member

Emily-Jiang commented May 18, 2020

@dmlloyd I think this issue is related to #559. However your comment suggests you think MP Config should not provide a way to programmatically set the default value. I am a bit confused.

@dmlloyd
Copy link
Contributor Author

dmlloyd commented May 18, 2020

In order to have a single, consistent view of default values, all default values should be established once (ideally when the configuration is being built). This can be done programmatically, or via the CDI mechanism, or by a mixture of both: the important thing is that the default value for a given property can only be defined one time.

The comment on #559 talks about adding a method to the accessor which allows a default value to be given at resolution time, which completely undermines the principle of having fixed default values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
use case 💡 An issue which illustrates a desired use case for the specification
Projects
None yet
Development

No branches or pull requests

3 participants