title: Parameter 0 of method init in 'Application' required a bean of type 'package' that could not be found
body: <p>I am trying to connect <code>Morphia</code> with <code>Java</code> and so tried implementing a project. But, I am getting the following error</p>
  
  <pre><code>***************************
  APPLICATION FAILED TO START
  ***************************
  
  Description:
  
  Parameter 0 of method init in code.nithin.application.Application required a bean of type 'code.nithin.repository.AssetRepository' that could not be found.
  
  
  Action:
  
  Consider defining a bean of type 'code.nithin.repository.AssetRepository' in your configuration.
  
  
  Process finished with exit code 1
  </code></pre>
  
  <p>The calling function is </p>
  
  <pre><code>@Bean
  public CommandLineRunner init(AssetRepository assetRepository){
      return (args) -&gt; {
          Asset test = new Asset(1, "https://example.com");
          System.out.println(assetRepository.save(test).getId());
      };
  }
  </code></pre>
  
  <p>The <code>AssetController</code> is</p>
  
  <pre><code>@Repository
  public class AssetController implements AssetRepository{
      @Autowired
      private Datastore datastore;
  
      @Override
      public Key&lt;Asset&gt; save(Asset asset){
          return datastore.save(asset);
      }
  }
  </code></pre>
  
  <p>and the <code>AssetRepository</code> is</p>
  
  <pre><code>public interface AssetRepository {
      public Key&lt;Asset&gt; save(Asset asset);
  }
  </code></pre>
  
  <p>The <code>Asset</code> class is </p>
  
  <pre><code>@Data
  @Entity("asset")
  @NoArgsConstructor
  public class Asset {
  
      @Id
      private ObjectId id;
      private String URL;
      private long timeStamp;
      private int version;
  
      public Asset(int version, String URL) {
          this.version = version;
          this.URL = URL;
          this.timeStamp = System.currentTimeMillis();
      }
  
      public ObjectId getId() {
          return id;
      }
  
      public String getURL() {
          return URL;
      }
  
      public long getTimeStamp() {
          return timeStamp;
      }
  
      public int getVersion() {
          return version;
      }
  
  }
  </code></pre>
  
  <p>Added entire <code>Application</code> class</p>
  
  <pre><code>package code.nithin.application;
  
  import org.springframework.boot.CommandLineRunner;
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration;
  import org.springframework.context.annotation.Bean;
  
  import code.nithin.entity.Asset;
  
  
  import code.nithin.repository.AssetRepository;
  
  
  @SpringBootApplication(exclude = EmbeddedMongoAutoConfiguration.class)
  public class Application {
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  
      @Bean
      public CommandLineRunner init(AssetRepository assetRepository){
          return (args) -&gt; {
              Asset test = new Asset(1, "https://example.com");
              System.out.println(assetRepository.save(test).getId());
          };
      }
  }
  </code></pre>