Error creating bean with name 'readstrackerDataLoaderApplication': Unsatisfied dependency expressed through field 'authorRepository'

Author: kusai elamir

Originally Sourced from: https://stackoverflow.com/questions/73529053/error-creating-bean-with-name-readstrackerdataloaderapplication-unsatisfied-d

I know that this question is a duplicate, but I have tried many of the suggestions that I found with no effect. I am a beginner to spring boot, and I am following a tutorial using Spring boot and Cassandra. I get this error once SpringApplication.run(ReadstrackerDataLoaderApplication.class, args) is executed.

ReadstrackerDataLoaderApplication.java

package com.readstracker.demo;

@SpringBootApplication(scanBasePackages = {"com.readstracker.repositories", "com.readstracker.entities"})
//@ComponentScan("repositories.AuthorRepository")
@EnableConfigurationProperties(DataStaxAstraProperties.class)
@EnableCassandraRepositories("com.readstracker.repositories")
@ComponentScan("com.readstracker.entities")

@Service
public class ReadstrackerDataLoaderApplication {

    @Autowired
    private AuthorRepository authorRepository;

    public static void main(String[] args) {
        SpringApplication.run(ReadstrackerDataLoaderApplication.class, args);
    }

    @PostConstruct
    public void start() {
        Author author = new Author();
        author.setId("id");
        author.setName("name");
        author.setPersonalName("personalName");
        authorRepository.save(author);
    }

    @Bean
    public CqlSessionBuilderCustomizer sessionBuilderCustomizer(DataStaxAstraProperties astraProperties) {
        Path bundle = astraProperties.getSecureConnectBundle().toPath();
        return builder -> builder.withCloudSecureConnectBundle(bundle);
    }
}

AuthorRepository.java

package com.readstracker.repositories;

import org.springframework.data.cassandra.repository.CassandraRepository;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.readstracker.entities.Author;
@Repository
public interface AuthorRepository extends CassandraRepository<Author, String> {

}

Author.java

package com.readstracker.entities;

import org.springframework.data.annotation.Id;
import org.springframework.data.cassandra.core.cql.PrimaryKeyType;
import org.springframework.data.cassandra.core.mapping.CassandraType;
import org.springframework.data.cassandra.core.mapping.CassandraType.Name;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.data.cassandra.core.mapping.Column;
import org.springframework.data.cassandra.core.mapping.PrimaryKeyColumn;
import org.springframework.data.cassandra.core.mapping.Table;

@Table(value = "author_by_id")
@Component
public class Author {

    @Id
    @PrimaryKeyColumn(name = "author_id", ordinal = 0, type = PrimaryKeyType.PARTITIONED)
    private String id;

    @Column("author_name")
    @CassandraType(type = Name.TEXT)
    private String name;

    @Column("personal_name")
    @CassandraType(type = Name.TEXT)
    private String personalName;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPersonalName() {
        return personalName;
    }

    public void setPersonalName(String personalName) {
        this.personalName = personalName;
    }

}

Here is my project directory

enter image description here