Skip to content

Commit e2f5094

Browse files
moudatsosMichael Moudatsos
and
Michael Moudatsos
authored
Fix value data-type & entry-set order issues of properties bound to Map (spring-cloud#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 <[email protected]>
1 parent 8364578 commit e2f5094

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)