title: spring boot autoconfiguration include
body: <p>Is there a way to include autoconfigurations based on profiles? (It would be nice if there was a <code>spring.autonfigure.include</code>)</p>
  
  <p>I would like to connect to an h2 database for testing and for local development. For ease of development, I would like <code>DataSourceAutoConfiguration.class</code>, <code>HibernateJpaAutoConfiguration.class</code>, and <code>DataSourceTransactionManagerAutoConfiguration.class</code> autoconfigured. However, I would like to be able to easily switch to an oracle database which is defined in the application server and configured in a Configuration class. When switching to the oracle database, I need to exclude the autoconfiguration classes above:</p>
  
  <pre><code>// This only works for the oracle database - need to include autoconfig
  // classes for h2 database
  @SpringBootApplication(
       exclude = {
         DataSourceAutoConfiguration.class,
         HibernateJpaAutoConfiguration.class,
         DataSourceTransactionManagerAutoConfiguration.class },
       scanBasePackages = {
         "foo.bar"
       })
  </code></pre>
  
  <p>I have an "h2" profile that configures the h2 database and several other profiles in which I want the live database (local, dev, test, qual, prod). I could use the <code>spring.autoconfigure.exclude</code> property on each of the live database profiles, but sometimes I want to switch between "live" and h2 databases locally. I could also figure out exactly what the excluded autoconfigure classes are doing and manually configure in an "h2" profile but I'd rather not duplicate effort.</p>
  
  <p>Anyone have ideas as to how to accomplish this?</p>