title: How to finally and completely disable hibernate in Spring Boot
body: <p>In a Spring Boot project that is not using JPA/Hibernate (but which cannot help but have these libraries on the classpath; long story, but completely unchangeable in this context), I need to stop whatever autoconfiguration is causing the error:</p>
  
  <pre><code>java.lang.IllegalArgumentException: At least one JPA metamodel must be present!
  </code></pre>
  
  <p>I am aware that I have to explicitly exclude JPA/Hibernate autoconfiguration. I do so in both the <code>@SpringBootApplication</code>-annotated Java class and also in the <code>application.properties</code> file.</p>
  
  <pre><code>@SpringBootApplication
  @EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class,
          DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class })
  @ComponentScan(basePackages = { "com" })
  @EnableAsync
  public class Application extends SpringBootServletInitializer {
      ...
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
  </code></pre>
  
  <p>Additionally, I've verified that these autoconfigurations are being excluded, by looking in the <code>--debug</code> output:</p>
  
  <pre><code>Exclusions:
  -----------
  
      org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
  
      org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
  
      org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
  </code></pre>
  
  <p>Still, it fails when I don't have a JPA <code>@Entity</code> defined. </p>
  
  <p>Why would this be?</p>