-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Refactor configuration completely #692
Conversation
And they say my PRs are too big ;) |
Well this was working. Infinispan has just come in and broken it. Repair incoming. |
Though I've requested a few reviews, and others are welcome to review as well, I'd prefer to merge this and fix anything else after, unless there's something catastrophic. |
+1 |
I've had a failure in module
|
Easy fix, I suppose. |
It's not clear why this one isn't using an implicit converter. They cannot be disabled AFAICT. |
Ah of course, native image. I'll have to probe these at startup. |
considering config might change.. should we just register all known converters for reflective access? |
Yeah. It's going to be a little bit of a challenge though; I'll have to make a build item for it. |
@ConfigProperty(name = "url") | ||
public String url; | ||
@ConfigItem | ||
public Optional<String> url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the connection url is mandatory to define a datasource. Do we still need these to be Optional
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now this is the only way I could exactly replicate the previous logic, which relied on optional configuration groups which will no longer be supported.
Once this is in, I think it's OK to change this to whatever is the best fit for the extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing to note is that you are not allowed to have mandatory properties in any event. So, typically this means you have to intelligently disable your service when required configuration is not present. Making a property non-optional means you'll have to have a null/empty check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not allowed to have mandatory properties in any event
"event" ?
So we just validate within the logic of the extensions, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"in any event" == "in any case/situation", sorry for the ambiguous language.
Yeah the extensions have to do validation though adding generalized validation for extension config is also on my todo list.
But the reason that mandatory properties cannot work is that our model allows extensions to be brought in by other extensions, and yet we have a mandate to start up with little or zero configuration in a useful state. Allowing mandatory configuration items will break this badly. So validation should be constrained to just verifying that values that were specified are in bounds, or should otherwise only fail as a result of something the user has done wrong (as opposed to something that happened automatically).
So a good semantic is to define the minimum property or properties that are required to enable the extension, and if none are given, that means "do not add this service", and if they're only partial, perhaps log a warning that some required properties are not present so the service is not activated. Only produce an error (stop) when there is a value explicitly specified, but it is not valid.
A fix for the converter issue is coming tomorrow. We don't want to merge this yet if it's going to break CI. |
• support multiple levels of hierarchy • handle at augment time via reflection instead of using code generation • distinguish build-/run-time injection items • generate config parsing with unknown key detection • lighten annotation processing to work better with eclipse (hopefully) • support a wide range of configuration types • require explicit specification of build phase for configuration groups Co-authored-by: Alexey Loubyansky <loubyansky@gmail.com> Co-authored-by: Stuart Douglas <stuart.w.douglas@gmail.com>
OK everything should be solved... pending CI. |
@dmlloyd Will there be further doc updates, as they are still referring to @ConfigProperty, instead of @configitem? Also - do the properties still come from MP-config? i.e. |
Sure I"ll add a todo for the docs; I will probably largely cut & paste them from the summary emails I'm going to be writing on the plane tomorrow. Yeah still using |
@dmlloyd should we use this opportunity to change the name and location of the file? |
• support multiple levels of hierarchy
• handle at augment time via reflection instead of using code generation
• distinguish build-/run-time injection items
• generate config parsing with unknown key detection
• lighten annotation processing to work better with eclipse (hopefully)
• support a wide range of configuration types
• require explicit specification of build phase for configuration groups
Co-authored-by: Alexey Loubyansky loubyansky@gmail.com
Co-authored-by: Stuart Douglas stuart.w.douglas@gmail.com