title: Spring bean where class is filtered...or how to choose between two beans?
body: <p>I have several XA datasources I need to configure within a Spring application context that I use for integration testing inside of Maven.  They look like this:</p>
  
  <pre><code>&lt;bean id="sbeH2XADataSource" class="org.h2.jdbcx.JdbcDataSource"&gt;
      &lt;property name="URL" value="$DS{hibernate.connection.url}" /&gt;
      &lt;property name="user" value="$DS{hibernate.connection.username}" /&gt;
      &lt;property name="password" value="$DS{hibernate.connection.password}" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="sbeMySQLXADataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"&gt;
      &lt;property name="URL" value="$DS{hibernate.connection.url}" /&gt;
      &lt;property name="user" value="$DS{hibernate.connection.username}" /&gt;
      &lt;property name="password" value="$DS{hibernate.connection.password}" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Ideally, I'd use Maven filtering to set the bean class, but Spring doesn't like that (at least not Spring tooling in Eclipse).  I really would like to avoid making both beans and rather just make the one.  In the event I have to make both and use only one, how does one create a bean "ref" that is dynamic?</p>