title: Spring Boot jdbcAuthentication dataSource not loaded error
body: <p>I have been working on spring boot for database authentication aplication. Install MySQL database on localhost. But problem is i can not even run my spring application. I use Eclipse with maven on Windows OS. Files that i created and errors are following:</p>
  
  <p>WebSecurityConfig.java:</p>
  
  <pre><code>import org.springframework.context.annotation.Configuration;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
  import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
  import javax.sql.DataSource;
  @Configuration
  public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Autowired  
      private DataSource dxataSource;
  
      @Autowired
      public void configure(AuthenticationManagerBuilder auth) throws Exception {
          auth.jdbcAuthentication().dataSource((DataSource) dxataSource).usersByUsernameQuery("select username,password, enabled from users where username=?");
      }
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
      http.authorizeRequests().anyRequest().fullyAuthenticated().and().formLogin();
      }
  }
  </code></pre>
  
  <p>Application.java:</p>
  
  <pre><code>import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class Application {
  
       public static void main(String[] args) {
  
          SpringApplication.run(Application.class, args);
       }
  
  }
  </code></pre>
  
  <p>HomeComtoller.java:</p>
  
  <pre><code>import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.RestController;
  
    @RestController
    public class HomeController {
  
     @GetMapping("/")
     public String index() {
         return "OK";
     }
   }
  </code></pre>
  
  <p>My pom.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0     http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;gs-authenticating-ldap&lt;/artifactId&gt;
      &lt;version&gt;0.1.0&lt;/version&gt;
       &lt;parent&gt;
           &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.5.6.RELEASE&lt;/version&gt;
       &lt;/parent&gt;
      &lt;properties&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;    
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;!-- tag::security[] --&gt; 
       &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
        &lt;/dependency&gt;        
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;      
      &lt;dependency&gt;
           &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.ldap&lt;/groupId&gt;
          &lt;artifactId&gt;spring-ldap-core&lt;/artifactId&gt;
         &lt;/dependency&gt;
      &lt;dependency&gt;
           &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-ldap&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
           &lt;groupId&gt;com.unboundid&lt;/groupId&gt;
          &lt;artifactId&gt;unboundid-ldapsdk&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
           &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
           &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
           &lt;scope&gt;test&lt;/scope&gt;
       &lt;/dependency&gt;
       &lt;dependency&gt;
           &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-test&lt;/artifactId&gt;
           &lt;scope&gt;test&lt;/scope&gt;
       &lt;/dependency&gt;
       &lt;/dependencies&gt;
       &lt;!-- end::security[] --&gt;
      &lt;build&gt;
           &lt;plugins&gt;
               &lt;plugin&gt;
                   &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
       &lt;/build&gt;
   &lt;/project&gt;
  </code></pre>
  
  <p>My application.properties file:</p>
  
  <pre><code>spring.datasource.url=jdbc:mysql://localhost:3306/testdb
  spring.datasource.username=test
  spring.datasource.password=password
  </code></pre>
  
  <p>The error appear while i try to run application (On Eclipse IDE):</p>
  
  <pre><code>Field dxataSource in auth.ldap.WebSecurityConfig required a bean of type 'javax.sql.DataSource' that could not be found.
  - Bean method 'dataSource' not loaded because @ConditionalOnClass did not find required class 'org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType'
  - Bean method 'dataSource' not loaded because @ConditionalOnClass did not find required classes 'javax.transaction.TransactionManager', 'org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType
  </code></pre>
  
  <p>any advice and suggestions will really helpful. Thanks.</p>