title: How can I tell Spring to use a Java map to resolve property placeholder?
body: <p>I have a <code>Map&lt;String, String&gt;</code> and I would like to tell Spring to use this when creating beans and resolving property placeholders. What is the easiest way to do this? Here is an example:</p>
  
  <pre><code>@Component
  public class MyClass {
     private String myValue;
  
      @Autowired
      public MyClass(@Value("${key.in.map}") String myValue) {
          this.myValue = myValue;
      }
  
      public String getMyValue() {
          return myValue;
      }
  }
  
  public static void main(String[] args) {
      Map&lt;String, String&gt; propertyMap = new HashMap&lt;&gt;();
      propertyMap.put("key.in.map", "value.in.map");
      ApplicationContext ctx = ...;
      // Do something???
      ctx.getBean(MyClass.class).getMyValue(); // Should return "value.in.map"
  }
  </code></pre>