title: Spring boot. Add jpa database connection and generate scheme
body: <p>I have a spring boot application and I need to connect to postgres database and generate scheme by Entities.
  This is my maven dependencies:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;version&gt;1.3.7.RELEASE&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
                  &lt;artifactId&gt;tomcat-jdbc&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-aop&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
                  &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
                  &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
          &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
          &lt;version&gt;9.4-1200-jdbc41&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>This is my application.properties:</p>
  
  <pre><code>spring.datasource.driverClassName=org.postgresql.Driver
  spring.datasource.url=jdbc:postgresql://localhost:5432/my_db
  spring.datasource.username=...
  spring.datasource.password=...
  
  spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
  spring.jpa.generate-ddl=true
  spring.jpa.show-sql=true
  spring.jpa.hibernate.ddl-auto=create
  </code></pre>
  
  <p>I also have a <code>User</code> class anotated with <code>@Entity</code> and <code>UsersRepository</code> that extends  extends <code>CrudRepository&lt;User, Long&gt;</code>.
  But it doesn't work. I got an exception:</p>
  
  <pre><code>2016-08-01 00:57:56.441 ERROR 17643 --- [main]
  o.s.boot.SpringApplication: Application startup failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name
  'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration':
  Injection of autowired dependencies failed; nested exception is. org.springframework.beans.factory.BeanCreationException:.Could not autowire field: private javax.sql.DataSource
  org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource;
  nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
  No qualifying bean of type [javax.sql.DataSource] found for dependency:
  expected at least 1 bean which qualifies as autowire candidate for this dependency.
  Dependency annotations:
  {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  </code></pre>
  
  <p>What else should I do to connect to database and generate scheme?</p>