title: How to convert @Propertysource file to Map?
body: <p>I have my contents in .properties file. I'm loading the properties file using @PropertySource.</p>
  
  <p>How do i get the contents from the properties file to map using @PropertySource Annotation?</p>
  
  <p>My Property file looks like this:</p>
  
  <pre><code>a= abc
  b= bcd
  c= cde
  </code></pre>
  
  <p>In my Component, I want to read the property file and put the contents in a map.</p>
  
  <pre><code>@PropertySource("classpath:myData.properties")
  public class myComponentService {
  
  @Autowired
  private Environment environment;
  
  Map&lt;String, String&gt; myMap = new HashMap&lt;String, String&gt;(); //Property file content goes here
  
  }  
  </code></pre>
  
  <p>I tried something like this, but this doesn't work. </p>
  
  <pre><code>Map&lt;String, String&gt; myMap= new HashMap&lt;String, String&gt;();
  Properties myProperties = new Properties();
  myProperties .putAll(myMap);
  </code></pre>