-
Notifications
You must be signed in to change notification settings - Fork 483
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
Add support for parsing Collections and Maps from the Spring YML format #739
base: 2.x
Are you sure you want to change the base?
Conversation
@@ -81,6 +82,14 @@ public Type getRawType() { | |||
return rawType; | |||
} | |||
|
|||
public boolean isMap() { |
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.
Maybe move these two to be private static helper methods in AbstractConfig? Then things would work with any ParametrizedType
, not just with ArchaiusType
.
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.
Good call, moved these into the AbstractConfig instead
@@ -298,6 +299,29 @@ protected <T> T getValue(Type type, String key) { | |||
@SuppressWarnings("unchecked") | |||
protected <T> T getValueWithDefault(Type type, String key, T defaultValue) { | |||
Object rawProp = getRawProperty(key); | |||
if (rawProp == null && type instanceof ArchaiusType) { |
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.
I don't ... hate this, but let's think about it a bit more. I'd really love it if there was some way we could call the existing decoders here instead of marshaling the entire map into a single string just to unmarshal it back a nanosecond later. The same goes for the List support.
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.
I updated the code to instead rely on the decoder inside the AbstractConfig. The typing does become a little more annoying, and I also didn't include some of the DefaultCollectionsTypeConverterFactory types (specifically SortedSet and LinkedList). Honestly no great reason for that, but our SBN docs only specifically reference Map, List, and Set.
Add support for understanding the Spring YML (YamlPropertiesFactoryBean) way of parsing YML files via the Archaius endpoints. This supports the ConfigProxy and PropertyRepository as these all are eventually backed by AbstractConfig.
This enables all existing Archaius read methods to read multi-line/multi-property maps and arrays as specified by Spring.
Spring YML files are converted to configs from this yml file
To these configs: