title: How to wire up a DataSourceTransactionManager with @Configuration @Beans instead of XML
body: <p>Typical XML for hooking up a transaction manager in Spring looks like:</p>
  
  <pre><code>&lt;bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt;
      &lt;property name="dataSource" ref="myDataSource" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="myDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"&gt;
      .... properties go here ....
  &lt;/bean&gt;
  </code></pre>
  
  <p>How do I accomplish the same thing with code?</p>
  
  <pre><code>@Configuration
  public class MyConfig {
    @Bean
    public DataSource myDataSource() {
         return new DataSource(); /// and set properties, etc.
    }
  
    @Bean
    public DataSourceTransactionManager txManager() {
         --&gt; What goes here? &lt;--
    }
  }
  </code></pre>
  
  <p>Specifically, how do I get txManager wired up to the myDataSource singleton via code?</p>