title: How can I configure JPA repositories for different DataSources in SpringBoot?
body: <p>I use spring boot app. I select data from DB by JDBC DataSource and Repositories. Some query by JDBS and some queries by Repositories. My DB configure RAC and has 2 instance. I connect to db by <code>129.0.0.2</code> but this URL balanced between <code>129.0.0.3(1 instance) and 129.0.0.4(2instance)</code>. All queries execute  with <code>129.0.0.2</code> but some queries I need to execute only on one instance. I created 3 datasources:</p>
  
  <pre><code>@Bean(name = "primary")
      @Primary
      @ConfigurationProperties(prefix = "spring.datasource")
      public DataSource primaryDataSource() {
          return DataSourceBuilder.create().build();
      }
  
      @Bean(name = "second")
      @ConfigurationProperties(prefix = "spring.secondDatasource")
      public DataSource secondaryDataSource() {
          return DataSourceBuilder.create().build();
      }
  
      @Bean(name = "three")
      @ConfigurationProperties(prefix = "spring.threeDatasource")
      public DataSource threeDataSource() {
          return DataSourceBuilder.create().build();
      }
  </code></pre>
  
  <p>And configure them in application.properties. Then I can write</p>
  
  <pre><code>@Qualifier("primary")DataSource dataSource
  </code></pre>
  
  <p>or</p>
  
  <pre><code>@Qualifier("second")DataSource dataSource
  </code></pre>
  
  <p>But what DataSource will use when I execute repositories query?</p>