title: Need to turn off JPA in SpringBoot app, get "At least one JPA metamodel must be present!"
body: <p>I'm working on a SpringBoot app that was generated from a rather complex template.  It's just a REST service that will access a db through a datasource.  It doesn't use JPA.</p>
  
  <p>When my app starts up, I see the following output (which is likely almost identical to other questions similar to this):</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: At least one JPA metamodel must be present!
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
      at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)
  Caused by: java.lang.IllegalArgumentException: At least one JPA metamodel must be present!
      at org.springframework.util.Assert.notEmpty(Assert.java:277)
      at org.springframework.data.jpa.mapping.JpaMetamodelMappingContext.&lt;init&gt;(JpaMetamodelMappingContext.java:52)
      at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:71)
      at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:26)
      at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:134)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
      ... 15 common frames omitted
  </code></pre>
  
  <p>I've already read most of the reports of the other occurrences of this, and I checked with someone else on my team who ran into the same problem, and I believe I have the correct fix, but it's still not working.</p>
  
  <p>The following is my Application class:</p>
  
  <pre><code>@SpringBootApplication
  @ComponentScan(basePackages = "com")
  //@EnableAsync
  //@EnableCaching
  @EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class,
                                       HibernateJpaAutoConfiguration.class,
                                       HazelcastAutoConfiguration.class,
                                       CacheAutoConfiguration.class,
                                       JpaRepositoriesAutoConfiguration.class })
  public class Application extends SpringBootServletInitializer {
      public static void main(String[] args) {
          new SpringApplicationBuilder().sources(Application.class, AppConfig.class).run(args);
      }
  }
  </code></pre>
  
  <p>In the application pom, I'm specifying "spring-boot-starter-web" as a dependency.</p>
  
  <p>What else could be wrong here?</p>