title: How can I qualify an autowired property with a variable from a config file using annotations?
body: <p>My specific problem is that I have configured two beans that implement the same interface and I have a third bean that has a property of that interface's type. I inject the property using a config property. So, assuming RemoteDataSource and LocalDataSource implement IDataSource and dao1 has a property of type IDataSource, my XML config might look like this:</p>
  
  <pre><code>&lt;bean id="datasource1" class="com.foo.RemoteDataSource"&gt;
    &lt;property name="url"&gt;${url}&lt;/property&gt;
  &lt;/bean&gt;
  &lt;bean id="datasource2" class="com.foo.LocalDataSource"&gt;
    &lt;property name="path"&gt;${filepath}&lt;/property&gt;
  &lt;/bean&gt;
  &lt;bean id="dao1" class="com.foo.MyDAO"&gt;
    &lt;property name="dataSource"&gt;${datasource}&lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>With url, filepath and datasource being defined in an included properties file. We are now making a push for annotation-driven configuration and I'm not sure how to annotate my dao to put the data source configured in the property file. I want to do something like this, but it is evidently not allowed:</p>
  
  <pre><code>@Autowired
  @Qualifier("${datasource}")
  public void setDataSource(IDataSource datasource) {...}
  </code></pre>
  
  <p>NB: this is spring 3</p>