You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If I use the @ConfigProperties annotation on an interface, I can customize config property names for the interface methods using the @ConfigProperty annotation.
I expect to be able to do the same for a class annotated with @ConfigProperties, but ClassConfigPropertiesUtil.populateConfigObject says '@ConfigProperty' is ignored when added to a field of a class annotated with '@ConfigProperties'.
This is not documented and is certainly unexpected. I don't even call this an enhancement proposal, but a bug -- I consider feature parity between @ConfigProperties classes and interfaces a natural expectation.
CC @geoand, as @mkouba said he's the author of the @ConfigProperties system :-)
The text was updated successfully, but these errors were encountered:
Basically I didn't want @ConfigProperty.defaultValue to come into play when using classes, as the default value should just be set in code. @Ladicek I assume that you want to be able to customize the field names, right? If so, then I guess we can relax the constraint and just disallow defaultValue. WDYT?
For complex types (with Converters), expressing default values in code doesn't necessarily have to be possible, so I'd say defaultValue should work as well. (And if it's set, then it should take precedence.) But yes, when I stumbled upon this, I was mainly after customizing the configuration key.
Describe the bug
If I use the
@ConfigProperties
annotation on aninterface
, I can customize config property names for the interface methods using the@ConfigProperty
annotation.I expect to be able to do the same for a
class
annotated with@ConfigProperties
, butClassConfigPropertiesUtil.populateConfigObject
says'@ConfigProperty' is ignored when added to a field of a class annotated with '@ConfigProperties'.
This is not documented and is certainly unexpected. I don't even call this an enhancement proposal, but a bug -- I consider feature parity between
@ConfigProperties
classes and interfaces a natural expectation.CC @geoand, as @mkouba said he's the author of the
@ConfigProperties
system :-)The text was updated successfully, but these errors were encountered: