title: Consider defining a bean of type 'service' in your configuration [Spring boot]
body: <p>I get error when I run the main class. </p>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>Action:
  Consider defining a bean of type 'seconds47.service.TopicService' in your configuration.
  
  Description:
  Field topicService in seconds47.restAPI.topics required a bean of type 'seconds47.service.TopicService' that could not be found
  </code></pre>
  
  <p>TopicService interface:</p>
  
  <pre><code>public interface TopicService {
  
      TopicBean findById(long id);
  
      TopicBean findByName(String name);
  
      void saveTopic(TopicBean topicBean);
  
      void updateTopic(TopicBean topicBean);
  
      void deleteTopicById(long id);
  
      List&lt;TopicBean&gt; findAllTopics(); 
  
      void deleteAllTopics();
  
      public boolean isTopicExist(TopicBean topicBean);
  }
  </code></pre>
  
  <p>controller:</p>
  
  <pre><code>@RestController
  public class topics {
  
      @Autowired
      private TopicService topicService;
  
      @RequestMapping(path = "/new_topic2", method = RequestMethod.GET)
      public void new_topic() throws Exception {
          System.out.println("new topic JAVA2");
      }
  }
  </code></pre>
  
  <p>Implementation class:</p>
  
  <pre><code>public class TopicServiceImplementation implements TopicService {
  
      @Autowired
      private TopicService topicService;
  
      @Autowired
      private TopicRepository topicRepository;
  
      @Override
      public TopicBean findById(long id) {
          throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
      }
  
      @Override
      public TopicBean findByName(String name) {
          throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
      }
  
      @Override
      public void saveTopic(TopicBean topicBean) {
          throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
      }
  
      @Override
      public void updateTopic(TopicBean topicBean) {
          throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
      }
  
      @Override
      public void deleteTopicById(long id) {
          throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
      }
  
      @Override
      public List&lt;TopicBean&gt; findAllTopics() {
          throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
      }
  
      @Override
      public void deleteAllTopics() {
          throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
      }
  
      @Override
      public boolean isTopicExist(TopicBean topicBean) {
          throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
      }
  }
  </code></pre>
  
  <p>Rest of the classes are defined too. I don't know why its throwing despite declaring <code>componentScan</code> in main class.</p>
  
  <p>Main class:</p>
  
  <pre><code>@SpringBootApplication(exclude = {SecurityAutoConfiguration.class })
  @ComponentScan(basePackages = {"seconds47"})
  @EnableJpaRepositories("seconds47.repository")
  public class Application {
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  }
  </code></pre>
  
  <p>I have my packages like this:</p>
  
  <pre><code>seconds47
  seconds47.beans
  seconds47.config
  seconds47.repository
  seconds47.restAPI
  seconds47.service
  </code></pre>