Parameter 0 of constructor

Не может найти бин с репозиторием. Обычно все фиксится аннотацией репо или же компонент над репозиторием, но не в данном случае, так же аннотация EnableCassandraRepository тоже не помогает, так же как и пустой конструктор

messageServiceImpl

@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class MessageServiceImpl implements MessageService {

    private final CassandraRepository<Message> cassandraRepository;
    private final SimpMessagingTemplate simpMessagingTemplate;
    private final ChatRoomService chatRoomService;

    @Override
    public void sendMessageToChatRoom(Message message) throws EntityNotFoundException {
        simpMessagingTemplate.convertAndSend(
                Destination.publicMessages(message.getChatRoomId()), message);

        sendMessageToDialog(message);
    }

    private void sendMessageToDialog(Message message) throws EntityNotFoundException {
        ChatRoom chatRoom = chatRoomService.findChatRoomById(message.getChatRoomId());

        chatRoom.getConnectedUsers().forEach(u -> {
            message.setToUser(u.getUsername());

            saveMessage(message);
        });
    }

    private void saveMessage(Message message) {
        cassandraRepository.save(Objects.requireNonNull(message));
    }
}

cassandra repository

@Repository
public interface ChatRoomRepository extends CrudRepository<ChatRoom, String> {

    Optional<ChatRoom> findChatRoomByChatRoomName(String chatRoomName);

    ChatRoom findByConnectedUsers(List<ChatRoomUser> connectedUser);
}

ошибка

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in com.microservice.messenger.messenger.service.impl.MessageServiceImpl required a bean of type 'org.springframework.data.cassandra.repository.CassandraRepository' that could not be found.


Action:

Consider defining a bean of type 'org.springframework.data.cassandra.repository.CassandraRepository' in your configuration.

build.gradle

plugins {
    id 'org.springframework.boot' version '2.6.1'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'com.microservice'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation group: 'io.projectreactor.netty', name: 'reactor-netty', version: '1.0.13'
    implementation 'org.springframework.boot:spring-boot-starter-amqp'
    implementation group: 'org.springframework.session', name: 'spring-session-data-redis', version: '2.6.1'
    implementation group: 'org.springframework.session', name: 'spring-session', version: '1.3.5.RELEASE'
    implementation group: 'org.springframework.data', name: 'spring-data-cassandra', version: '1.1.0.RELEASE'
    implementation group: 'com.auth0', name: 'java-jwt', version: '3.18.2'
    implementation group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-data-redis'
    implementation group: 'redis.clients', name: 'jedis', version: '3.7.0'
    implementation group: 'org.modelmapper', name: 'modelmapper', version: '2.4.5'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-websocket'
    implementation group: 'org.webjars', name: 'stomp-websocket', version: '2.3.4'
    implementation 'org.flywaydb:flyway-core'
    implementation 'junit:junit:4.13.1'
    compileOnly 'org.projectlombok:lombok'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    runtimeOnly 'org.postgresql:postgresql'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.amqp:spring-rabbit-test'
    testImplementation 'org.springframework.security:spring-security-test'
}

test {
    useJUnitPlatform()
}

Ответы (1 шт):

Автор решения: aron

Arhur Vartanyan из комментариев был прав, проблема крылась в достаточно старой версии cassandra spring data, поменял версию на последнюю и ошибка исчезла

→ Ссылка