Skip to content

Escaped dots in Spring configuration keys are not properly translated #1359

@bart-vmware

Description

@bart-vmware

Describe the bug

As described at https://docs.spring.io/spring-boot/reference/features/external-config.html#features.external-config.yaml.mapping-to-properties, Spring Boot supports escaping dots in configuration keys:

When binding to scalar values, keys with . in them do not need to be surrounded by []. Scalar values include enums and all types in the java.lang package except for Object. Binding a.b=c to Map<String, String> will preserve the . in the key and return a Map with the entry {"a.b"="c"}. For any other types you need to use the bracket notation if your key contains a .. For example, binding a.b=c to Map<String, Object> will return a Map with the entry {"a"={"b"="c"}} whereas [a.b]=c will return a Map with the entry {"a.b"="c"}.

Based on that, Steeltoe should translate the Spring configuration key a.b.c to a:b:c (which it already does). But also translate [a.b].c to a.b:c, which is currently not the case. And translate arrays, such as a[0].b to a:0:b (which it already does).

Because there's no way to escape colons in .NET configuration keys, there's nothing Steeltoe can do to properly translate when the Spring key contains a colon.

This affects the various Steeltoe configuration providers, such as Placeholder, SpringBoot, and Config Server. Key translation isn't correct everywhere and there's limited test coverage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component/ConfigurationIssues related to Configuration providersType/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions