title: Consider defining a bean of type 'org.springframework.jdbc.core.JdbcTemplate' in your configuration
body: <blockquote>
    <p>package name: com.sample</p>
    
    <p>SpringMain.java</p>
  </blockquote>
  
  <pre><code>@SpringBootApplication
  @ComponentScan
  public class SpringMain implements CommandLineRunner
  {
      @Autowired
      SampleClass sampleClass;
  
      public static void main(String[] args) {
          SpringApplication.run(SpringMain.class, args);
  
      }
  
      @Override
      public void run(String... args) throws Exception 
      {
          sampleClass.callThread();
      }
  }
  </code></pre>
  
  <blockquote>
    <p>pacakge name: com.sample.infra</p>
    
    <p>SampleClass.java</p>
  </blockquote>
  
  <pre><code>@Component
  public class SampleClass 
  {
  
      @Autowired
      ThreadSample threadSample;
  
      public void callThread()
      {
          System.out.println("Inside SampleClass");
          threadSample.start();
      }
  }
  </code></pre>
  
  <blockquote>
    <p>pacakage name: com.sample.dao</p>
    
    <p>ThreadSample.java</p>
  </blockquote>
  
  <pre><code>@Component
  public class ThreadSample extends Thread
  {
      @Autowired
      JdbcTemplate jdbcTemplate;
  
      public void run()
      {
          init();
      }
  
      public String init()
      {
          System.out.println("Inside ThreadSample");
          SimpleJdbcCall jdbcCall = new SimpleJdbcCall(jdbcTemplate).withProcedureName("sp_procedureName");
  
          Map&lt;String, Object&gt; initiatorMapData = jdbcCall.execute();
  
          JSONArray initiatorJSONArray = JSONArray.fromObject(initiatorMapData.get("#result-set-1"));
  
          System.out.println("GetInitiators JSONArray: "+initiatorJSONArray);
  
          return initiatorJSONArray.toString();
      }
  }
  </code></pre>
  
  <p>application.properties</p>
  
  <pre><code>#DB Credentials
  spring.datasource.url=jdbc:jtds:sqlserver://1.12.13.14
  spring.datasource.username=uname
  spring.datasource.password=pwd
  </code></pre>
  
  <p>pom.xml</p>
  
  <pre><code>&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;springBoot&lt;/groupId&gt;
    &lt;artifactId&gt;springBoot&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  
    &lt;properties&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&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.10.RELEASE&lt;/version&gt;
      &lt;/parent&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;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;tomcat-annotations-api&lt;/artifactId&gt;
                  &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;tomcat-embed-core&lt;/artifactId&gt;
                  &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;tomcat-embed-el&lt;/artifactId&gt;
                  &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;tomcat-embed-websocket&lt;/artifactId&gt;
                  &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
              &lt;/exclusion&gt;
           &lt;/exclusions&gt;
       &lt;/dependency&gt;
  
  &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;net.sourceforge.jtds&lt;/groupId&gt;
              &lt;artifactId&gt;jtds&lt;/artifactId&gt;
              &lt;version&gt;1.3.1&lt;/version&gt;
          &lt;/dependency&gt;
  
  &lt;dependency&gt;
              &lt;groupId&gt;net.sf.json-lib&lt;/groupId&gt;
              &lt;artifactId&gt;json-lib&lt;/artifactId&gt;
              &lt;version&gt;2.4&lt;/version&gt;
              &lt;classifier&gt;jdk15&lt;/classifier&gt;
          &lt;/dependency&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>Now when I place all files under one package it works fine. But when I distribute according to functionality then error occurs. How can I resolve this issue.</p>
  
  <p>After adding basepackages as suggested below, I have received error as </p>
  
  <pre><code> .   ____          _            __ _ _
   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
  ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
   =========|_|==============|___/=/_/_/_/
   :: Spring Boot ::       (v1.5.10.RELEASE)
  
  2018-04-25 11:37:33.615  INFO 11552 --- [           main] com.sample.SpringMain                    : Starting SpringMain on Computer with PID 11552 (D:\SpringExample\springBoot\target\classes started by User in D:\SpringExample\springBoot)
  2018-04-25 11:37:33.617  INFO 11552 --- [           main] com.sample.SpringMain                    : No active profile set, falling back to default profiles: default
  2018-04-25 11:37:33.655  INFO 11552 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@2f490758: startup date [Wed Apr 25 11:37:33 IST 2018]; root of context hierarchy
  2018-04-25 11:37:34.370  WARN 11552 --- [           main] o.h.v.m.ParameterMessageInterpolator     : HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported
  2018-04-25 11:37:34.559  WARN 11552 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'asynchronousService': Unsatisfied dependency expressed through field 'taskExecutor'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.core.task.TaskExecutor' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  2018-04-25 11:37:34.564  INFO 11552 --- [           main] utoConfigurationReportLoggingInitializer : 
  
  Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
  2018-04-25 11:37:34.626 ERROR 11552 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
  
  ***************************
  APPLICATION FAILED TO START
  ***************************
  
  Description:
  
  Field taskExecutor in com.sample.dao.AsynchronousService required a bean of type 'org.springframework.core.task.TaskExecutor' that could not be found.
  
  
  Action:
  
  Consider defining a bean of type 'org.springframework.core.task.TaskExecutor' in your configuration.
  </code></pre>