Fix value data-type & entry-set order issues of properties bound to Map (#554)

* Fix value data-type & entry-set order issues of properties bound to Map

Issue: properties bound to a java.util.Map object do not maintain their
definition order and their values lose their data-type, since they 're
converted to String values.
This fix mainly targets org.springframework.cloud.kubernetes.config
.PropertySourceUtils.PROPERTIES_TO_MAP implementation: Configuration
properties that are bound to a java.util.Map had their value's type
affected by the use of .toString() on each entry's value during Map
entry processing. Moreover, the use of java.util.stream
.Collectors.toMap(java.util.function.Function<? super T,? extends K>,
java.util.function.Function<? super T,? extends U>) when processing
Map-bound properties, resulted in losing the entry insertion order of
the original Map. The fix entails usage of the origina lentry value and
a Collectors.toMap() variant that maintains the behavior of the method
previously used, yet uses a java.util.LinkedHashMap as the target data
structure for the processed entries. Ramification changes on method
signature and return type have been applied where needed.

* applying checkstyle

* updated unit tests to account for the property loading behavior that
maintains intended value data type

* updated unit tests to account for the property loading behavior that
maintains intended value data type

* reverting test changes that target .properties files.
Current fix targets only properties loaded from .yml files.
org.springframework.cloud.kubernetes.config
.PropertySourceUtils.KEY_VALUE_TO_PROPERTIES should be altered in order
to address the same problem for configuration properties loaded from
.properties files

Co-authored-by: Michael Moudatsos <v-mmoudatsos@eurobank.gr>
This commit is contained in:
moudatsos
2020-06-25 00:10:10 +03:00
committed by GitHub
parent 8364578873
commit e2f509491f

Diff Content Not Available