title: No qualifying bean of type expected at least 1 bean which qualifies as autowire candidate
body: <p>No qualifying bean of type 'com.ms.common.subscription.service.client.SubscriptionDetailService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}  I am having problem that i cant run my code, but i have try by adding the @Service @Repository</p>
  <p>The error occur when i add the subscription at the service else it can run and display the result</p>
  <p>Application (main class)</p>
  <pre><code>package com.ms.batch.inactiveUser;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.boot.autoconfigure.domain.EntityScan;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
  
  @SpringBootApplication
          //(scanBasePackages={&quot;com.ms.batch.inactiveuser&quot;})
  
  @ComponentScan(basePackages = {
          &quot;com.ms.core, &quot; +
  
          &quot;com.ms.batch.inactiveuser, &quot; +
          &quot;com.ms.common.subscription.service.client, &quot; +
          &quot;com.ms.common.subscription.strategy.appmode, &quot; +
          &quot;com.ms.batch.inactiveuser.rest.config &quot;
  })
  @EntityScan(&quot;com.ms.batch.inactiveuser.rest.model.entity&quot;)
  @EnableJpaRepositories(&quot;com.ms.batch.inactiveuser.rest.repository&quot;)
  
  public class BatchInactiveUserApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(BatchInactiveUserApplication.class, args);
      }
  
  }
  </code></pre>
  <p>DTO</p>
  <pre><code>
  @Data
  @AllArgsConstructor
  @NoArgsConstructor
  @Builder
  public class CorporateUserDTO {
      private String oranizationID;
      private String coperateID;
    //  private String userCD;
    private String userID;
      private String userName;
      private String localContactNo;
      private String overseaContactNo;
    //  private String policyValue;
  }
  </code></pre>
  <p>Service</p>
  <pre><code>package com.ms.batch.inactiveUser.rest.service;
  
  import com.ms.batch.inactiveUser.rest.model.dto.CorporateUserDTO;
  import com.ms.batch.inactiveUser.rest.model.entity.CorporateUser;
  import com.ms.batch.inactiveUser.rest.model.entity.SecurityPolicy;
  import com.ms.batch.inactiveUser.rest.model.entity.User;
  import com.ms.batch.inactiveUser.rest.repository.InactiveUserRepository;
  import com.ms.batch.inactiveUser.rest.repository.SecurityPolicyRepository;
  import com.ms.batch.inactiveUser.rest.repository.UserRepository;
  import com.ms.common.subscription.model.request.SubscriptionDetailRequest;
  import com.ms.common.subscription.model.response.SubscriptionDetailResponse;
  import com.ms.common.subscription.service.client.SubscriptionDetailService;
  import lombok.AllArgsConstructor;
  import lombok.extern.slf4j.Slf4j;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.annotation.Bean;
  import org.springframework.stereotype.Service;
  import org.springframework.transaction.annotation.Transactional;
  import org.springframework.util.CollectionUtils;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
  @Service(&quot;inactiveUserService&quot;)
  @Transactional
  @AllArgsConstructor
  @Slf4j
  public class InactiveUserServiceImpl implements InactiveUserService {
  
      @Autowired
      private InactiveUserRepository inactiveUserRepository;
      @Autowired
      private SecurityPolicyRepository securityPolicyRepository;
      @Autowired
      private UserRepository userRepository;
  
      @Autowired
     // @Qualifier(&quot;SubscriptionDetailService&quot;)
      private SubscriptionDetailService subscriptionDetailService;
  
      @Override
      public List&lt;CorporateUserDTO&gt; findCorporateUser() {
          
          List&lt;CorporateUserDTO&gt; corporateUserDTOList = new ArrayList&lt;&gt;();
          if(CollectionUtils.isEmpty(user)){
              log.debug(&quot;testing user:error&quot;);
            
          }else {
              for (int i = 0; i &lt; user.size(); i++) {
             
                  List&lt;CorporateUser&gt; corporateUser = inactiveUserRepository.findUser(user.get(i).getUserID());
                  log.debug(&quot;testing my: &quot; +corporateUser.get(0).getUserName());
  
                  String subscriptionCode = &quot;IA_US&quot;;
                  for(int j = 0; j &lt; corporateUser.size(); j++){
                      CorporateUserDTO corporateUserDTO = new CorporateUserDTO();
                      corporateUserDTO.setOranizationID(corporateUser.get(j).getCorporate().getOrganizationID());
                      corporateUserDTO.setCoperateID(corporateUser.get(j).getCorporateID());
                      corporateUserDTO.setUserID(user.get(j).getUserID());
                      corporateUserDTO.setUserName(corporateUser.get(j).getUserName());
                      corporateUserDTO.setLocalContactNo(corporateUser.get(j).getCorporate().getCountry().getLocalContactNo());
                      corporateUserDTO.setOverseaContactNo(corporateUser.get(j).getCorporate().getCountry().getOverseaContactNo());
                      
                      corporateUserDTOList.add(corporateUserDTO);
  
                      Map&lt;String, SubscriptionDetailResponse&gt; subscriptionList = getSubscriptionDetails(corporateUserDTO.getUserID(),subscriptionCode);
                      log.debug(&quot;testing subscription: &quot; +subscriptionList);
                  }
              }
          }
          return corporateUserDTOList;
      }
  
      @Override
    //  @Qualifier(&quot;SubscriptionDetailService&quot;)
      @Bean
      public Map&lt;String, SubscriptionDetailResponse&gt; getSubscriptionDetails(String userId, String subscriptionCode) {
          log.debug(&quot;process getSubscriptionDetails - userId : &quot;+ userId);
          log.debug(&quot;process getSubscriptionDetails - subscriptionCode : &quot;+ subscriptionCode);
  
          SubscriptionDetailRequest subscriptionDetailRequest = new SubscriptionDetailRequest();
          Map&lt;String, Object&gt; recipientSettingMap = new HashMap&lt;String, Object&gt;();
          recipientSettingMap.put(&quot;userId&quot;, userId);
          subscriptionDetailRequest.setSubscriptionItemCode(subscriptionCode);
          subscriptionDetailRequest.setRecipientSettingValue(recipientSettingMap);
  
          return subscriptionDetailService.getSubscriptionDetails(subscriptionDetailRequest);
      }
  }
  
  </code></pre>
  <p>Controller</p>
  <pre><code>package com.ms.batch.inactiveUser.rest.controller;
  
  import com.ms.batch.inactiveUser.rest.service.InactiveUserService;
  import com.ms.batch.inactiveUser.rest.model.dto.CorporateUserDTO;
  import lombok.extern.slf4j.Slf4j;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.http.HttpStatus;
  import org.springframework.web.bind.annotation.PostMapping;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.ResponseStatus;
  import org.springframework.web.bind.annotation.RestController;
  
  import javax.servlet.http.HttpServletRequest;
  import java.util.List;
  
  @RestController
  @RequestMapping(value = &quot;/v1&quot;)
  @Slf4j
  public class InactiveUserController {
  
      @Autowired
      private InactiveUserService inactiveUserService;
  
      @PostMapping(value = &quot;/getReceipentUserInactive&quot;)
      @ResponseStatus(HttpStatus.OK)
      public List&lt;CorporateUserDTO&gt; getCorporateUser(HttpServletRequest request){
         //CorporateUser username= inactiveUserService.getAll();
          //CorporateUserVO corporateUserVO = (CorporateUserVO)request.getAttribute();
          return inactiveUserService.findCorporateUser();
      }
  }
  </code></pre>
  <p>Repository</p>
  <pre><code>package com.ms.batch.inactiveUser.rest.repository;
  
  import com.ms.batch.inactiveUser.rest.model.entity.CorporateUser;
  import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.data.jpa.repository.Query;
  import org.springframework.data.repository.query.Param;
  import org.springframework.stereotype.Repository;
  
  import java.util.List;
  import java.util.UUID;
  
  @Repository
  public interface InactiveUserRepository extends JpaRepository&lt;CorporateUser, UUID&gt; {
      @Query(&quot;select u,t,prov from CorporateUser u &quot; +
              &quot;join u.corporate t &quot; +
              &quot;join t.country prov &quot; +
              &quot;where &quot;+
              nvl(sec.lastLogon,cast(sec.dateCreated as date))) &quot;)
      List&lt;CorporateUser&gt;findUser(@Param(&quot;userid&quot;)String userid);
  }
  
  </code></pre>
  <p>Service interface</p>
  <pre><code>public interface InactiveUserService {
      List&lt;CorporateUserDTO&gt; findCorporateUser();
     // List&lt;UserVO&gt; findUser();
      Map&lt;String, SubscriptionDetailResponse&gt; getSubscriptionDetails(String userId, String subscriptionCode);
  
  }
  </code></pre>
  <p>Error when debug</p>
  <pre><code>org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.ms.batch.inactiveUser.rest.repository.InactiveUserRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
      at 
  org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:228) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1358) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
      at com.ocbc.ms.batch.inactiveUser.BatchInactiveUserApplication.main(BatchInactiveUserApplication.java:26) ~[classes/:na]
  
  2020-08-21 11:04:12.490 ERROR 10992 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
  
  ***************************
  APPLICATION FAILED TO START
  ***************************
  
  Description:
  
  Parameter 0 of constructor in com.ms.batch.inactiveUser.rest.service.InactiveUserServiceImpl required a bean of type 'com.ms.batch.inactiveUser.rest.repository.InactiveUserRepository' that could not be found.
  
  The injection point has the following annotations:
      - @org.springframework.beans.factory.annotation.Autowired(required=true)
  
  
  Action:
  
  Consider defining a bean of type 'com.ms.batch.inactiveUser.rest.repository.InactiveUserRepository' in your configuration.
  
  Disconnected from the target VM, address: '127.0.0.1:57489', transport: 'socket'
  
  Process finished with exit code 1
  </code></pre>