title: Spring Boot configure and use two data sources
body: <p>How can I configure and use two data sources?</p>
  <p>For example, here is what I have for the first data source:</p>
  <p><strong>application.properties</strong></p>
  <pre><code>#first db
  spring.datasource.url = [url]
  spring.datasource.username = [username]
  spring.datasource.password = [password]
  spring.datasource.driverClassName = oracle.jdbc.OracleDriver
  
  #second db ...
  </code></pre>
  <p><strong>Application class</strong></p>
  <pre><code>@SpringBootApplication
  public class SampleApplication
  {
      public static void main(String[] args) {
          SpringApplication.run(SampleApplication.class, args);
      }
  }
  </code></pre>
  <p>How do I modify <code>application.properties</code> to add another data source? How do I autowire it to be used by a different repository?</p>