Я пытаюсь внедрить репозиторий данных Spring в тесте Junit 5, но получаю
No qualifying bean of type 'com.xxx.core.security.datastore.AccountsRepository' available: expected at least 1 bean which qualifies as autowire candidate
вот тест
package com.xxx.core.security.datastore;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
@SpringJUnitConfig
class AccountsRepositoryTest {
@Autowired
AccountsRepository accountsRepository;
@BeforeEach
void setUp() {
Assumptions.assumeTrue(true); // how to get spring profile !
}
@Test
public void name() {
}
}
А вот мой репо
package com.xxx.core.security.datastore;
import com.checkit.core.security.datastore.model.Account;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface AccountsRepository extends CrudRepository<Account,Long> {
Account findByName(String name);
}
Когда я запускаю приложение, кажется, что пружина все связывает