title: Sping-Boot Config: How to keep whitespace in yaml key being used to populate Map<String, String>
body: <p>Let's say we have a configuration properties class:</p>
  
  <pre><code>@ConfigurationProperties(prefix = "whitespace.test")
  public class WhitespaceTestConfig {
  
      private Map&lt;String, String&gt; configs;
  
      public Map&lt;String, String&gt; getConfigs() {
          return configs;
      }
  
      public void setConfigs(Map&lt;String, String&gt; configs) {
          this.configs = configs;
      }
  }
  </code></pre>
  
  <p>and we try to configure it with a key with space included in it:</p>
  
  <pre><code>whitespace.test.configs:
    Key With Whitespace: "I am a value with whitespace in it"
  </code></pre>
  
  <p>Seems as through spring can parse this yaml fine, and it is apparently valid yaml. However, spring (SnakeYaml?) removes the spaces in the Key string:</p>
  
  <pre><code>KeyWithWhitespace -&gt; I am a value with whitespace in it
  </code></pre>
  
  <p>An easy solution is to designate a special character for space and replace it within the application, but I was wondering if spring already handled this in some fashion? Perhaps there is a way to escape a space in the config in such a way that spring (SnakeYaml?) knows the we want to keep it, or perhaps there is a way to configure this?</p>
  
  <p>For the sake of completeness I've tried using single and double quotations as well as <code>\s</code> <code>\b</code>.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>After some additional research I found an example from SnakeYaml repository that seems to indicate that what I'm looking for should be possible: <a href="https://bitbucket.org/asomov/snakeyaml/wiki/Documentation#markdown-header-block-mappings" rel="noreferrer">https://bitbucket.org/asomov/snakeyaml/wiki/Documentation#markdown-header-block-mappings</a></p>
  
  <p>Specifically this example:</p>
  
  <pre><code># YAML
  base armor class: 0
  base damage: [4,4]
  plus to-hit: 12
  plus to-dam: 16
  plus to-ac: 0
  </code></pre>
  
  <pre><code># Java
  {'plus to-hit': 12, 'base damage': [4, 4], 'base armor class': 0, 'plus to-ac': 0, 'plus to-dam': 16}
  </code></pre>
  
  <p>In the example the spaces persist in the keys. Unfortunately, I'm at a loss with regard to figuring out where the whitespace is actually getting removed.</p>