title: Custom transaction managent in spring boot application with @EnableAutoConfiguration
body: <p>I'm implementing custom transaction management for a cache memory (simple <code>HashMap</code> at this time) in a spring boot application. The application already uses <code>JpaTransactionManager</code> configured by some magic behind <code>@EnableAutoConfiguration</code>. And this is problem, because application tries to load two <code>PlatformTransactionManager</code>s and throws:</p>
  
  <pre><code>org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.transaction.PlatformTransactionManager] is defined: expected single matching bean but found 2: cacheTransactionManager,transactionManager.
  </code></pre>
  
  <p>Transaction manager class:</p>
  
  <pre><code>@Component
  public class KpiCacheTransactionManager extends AbstractPlatformTransactionManager{
  ...
  }
  </code></pre>
  
  <p>My transaction manager is loaded by this configuration class:</p>
  
  <pre><code>@Configuration
  @EnableTransactionManagement
  public class CacheTransactionConfiguration {
  
      @Bean(name = "cacheTransactionManager")
      public PlatformTransactionManager cacheTransactionManager() {
          return new CacheTransactionManager();
      }     
  }
  </code></pre>
  
  <p>Main application is runned using this configuration:</p>
  
  <pre><code>@Configuration("MyApplication")
  @EnableAutoConfiguration
  @EntityScan("com.foo.bar")
  @EnableJpaRepositories("com.foo.bar")
  @EnableTransactionManagement(mode = AdviceMode.ASPECTJ)
  @ComponentScan("com.foo.bar")
  @ImportResource({...})
  public class MyApplication extends SpringBootServletInitializer{
  }
  </code></pre>
  
  <p>I've found some possible solutions (<code>@Primary</code> annotation, manager names,... ), but I don't know how to set this on existing configuration with <code>@EnableAutoConfiguration</code>, how to override the default configuration for <code>JpaTransactionManager</code> with my own.</p>
  
  <p>Env: Java 8, Spring Boot 1.2.1, Spring 4.1.4, Spring data JPA 1.7.2, Hibernate 4.3.7, Apache Tomcat 8.0.15</p>