1

I don't know if it's normal behaviour or a bug. I've created a ConfiguationProperties :

@Configuration
@ConfigurationProperties("sample")
public class MyConfig {


    private Map<String, String> labels;


    public Map<String, String> getLabels() {
        return labels;
    }

    public void setLabels(Map<String, String> labels) {
        this.labels = labels;
    }
}

And a Yaml File :

sample:
  labels:
    simple: value1
    net.gcuisinier: value2
    net.gcuisinier/env: value3

But for an unknown reason, the result map contains

simple=value1
net.gcuisinier=value2
net.gcuisinierenv=value3 

Without the "/" in the last key.

Does anyone know if it's normal ? Or it's a bug?

You can find a simple project that reproduce the "problem" here : https://github.com/gcuisinier/spring-issue

  • Does this answer your question? [How to read properties with special characters from application.yml in springboot](https://stackoverflow.com/questions/57147000/how-to-read-properties-with-special-characters-from-application-yml-in-springboo) – Ryuzaki L Jan 12 '21 at 05:26

1 Answers1

1

I think this is the normal behaviour. There is a section in the documentation explaining how to keep the escaped characters (/ in you case).

sample:
  labels:
    simple: value1
    net.gcuisinier: value2
    "[net.gcuisinier/env]": value3

Spring boot documentation: https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config-relaxed-binding-maps

GuanacoBE
  • 442
  • 1
  • 7
  • 12