title: Error in creating bean: Unsatisfied dependency expressed through constructor parameter 1
body: <p><strong>Error obtained while runtime of the code</strong></p>
  
  <pre><code>EVERE: StandardWrapper.Throwable
  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'xx' defined in file [/home/xx/sts_ws4/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/mis-compliance/WEB-INF/classes/com/moveinsync/compliance/services/xx.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.String' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:732)
      at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:197)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1267)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1124)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
      at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:672)
      at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:541)
      at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:499)
      at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:172)
      at javax.servlet.GenericServlet.init(GenericServlet.java:158)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1188)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1024)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5085)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5397)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1410)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1400)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
  Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.String' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1506)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1101)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062)
      at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:818)
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:724)
      ... 28 more
  
  Oct 05, 2018 9:15:15 AM org.apache.catalina.core.StandardContext loadOnStartup
  SEVERE: Servlet [dispatcher] in web application [/mis-compliance] threw load() exception
  org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.String' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1506)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1101)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062)
      at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:818)
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:724)
      at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:197)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1267)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1124)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
      at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:672)
      at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:541)
      at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:499)
      at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:172)
      at javax.servlet.GenericServlet.init(GenericServlet.java:158)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1188)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1024)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5085)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5397)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1410)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1400)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  
  <p><strong>Service class: Here I have annotted this class as well as mentioned this 
   package in @componentscan annotation</strong></p>
  
  <pre><code>@Service
  public class EHSCheckedVehiclesGetter implements Callable&lt;List&lt;VehicleEHSDTO&gt;&gt; {
  
    private VehicleEHSRepository vrepo;
  
    private String buid;
  
    public EHSCheckedVehiclesGetter() {
  
    }
    public EHSCheckedVehiclesGetter(VehicleEHSRepository vrepo, String buid) {
      Assert.notNull(vrepo, "VehicleEHSInfoRepository cannot be null");
      Assert.notNull(buid, "Business Unit Id cannot be null");
      this.vrepo = vrepo;
      this.buid = buid;
    }
  
    @Override
    public List&lt;VehicleEHSDTO&gt; call() throws Exception {
      List&lt;PVehicleEHSChecklistStatus&gt; pVehicleEHSInfos = vrepo.findByBuid(buid);
      List&lt;VehicleEHSDTO&gt; vehicleEHSInfoDTOs = VehicleUtils.convert(pVehicleEHSInfos);
      return vehicleEHSInfoDTOs;
    }
  </code></pre>
  
  <p><strong>Repository class: this is the interface for repository and the I have given this package in @EnableJpaRepositories annotation in as base packages</strong></p>
  
  <pre><code>public interface VehicleEHSRepository extends JpaRepository&lt;PVehicleEHSChecklistStatus, PVehicleEHSChecklistStatusId&gt;,
      MISRevisionRepository&lt;PVehicleEHSChecklistStatus, PVehicleEHSChecklistStatusId, Integer&gt; {
  
    @Query("from PVehicleEHSChecklistStatus where id.businessUnitId = ?1")
    List&lt;PVehicleEHSChecklistStatus&gt; findByBuid(String buid);
  
    @Query("from PVehicleEHSChecklistStatus where id.vehicleId = ?1")
    List&lt;PVehicleEHSChecklistStatus&gt; findByVehicleId(String vehicleId);
  </code></pre>
  
  <p>Can this be related to something other than this, because I'm trying to update my tech stack in project. </p>