title: Inject a Map<String, List<String>> using Spring's @Value
body: <p>I have a properties file that contains a map with keys that each have multiple values, like below</p>
  
  <pre><code>//properties.yml
  myMap:
    key1: value1, value2
    key2: value1, value2, value3
  </code></pre>
  
  <p>It is fairly easy to read <code>myMap</code> using a Spring properties class as follows:</p>
  
  <pre><code>@Configuration
  @ConfigurationProperties
  public class MyConfiguration {
    private Map&lt;String, List&lt;String&gt;&gt; myMap;
  
    public Map&lt;String, List&lt;String&gt;&gt; getMyMap() {
        return myMap;
    }
  
    public void setMyMap(Map&lt;String, List&lt;String&gt;&gt; myMap) {
        this.myMap = myMap;
    }
  }
  </code></pre>
  
  <p>However this feels like a lot of code for a simple task. I was wondering if there is a way to achieve the same thing using Spring's <code>@Value</code> annotation? I've tried to get it to work without success, trying things like</p>
  
  <pre><code>@Value("${myMap}")
  private Map&lt;String, List&lt;String&gt;&gt; myMap;
  </code></pre>
  
  <p>I think maybe it requires SPEL but I'm not sure how</p>