Поле redisRepository в 'service' требует bean-компонента типа 'repositpry', который не может быть найден - PullRequest
0 голосов
/ 11 января 2019

org.test.service.ResidService

@Slf4j
@Service
public class RedisService {
    private final RedisRepository redisRepository;

    public RedisService(final RedisRepository redisRepository) {
        this.redisRepository = redisRepository;
    }

    public List<Token> getAllRedisToken() {
        String token = "...";
        Map<byte[], byte[]> aa = redisRepository.hGetAll(token.getBytes());
        log.info(aa.toString());
        return null;
    }
}

org.test.repository.RedisRepository

@SpringBootApplication
@Service
public interface RedisRepository extends RedisHashCommands {}

Произошла ошибка при попытке выполнить код.

Description:

Field redisRepository in org.test.service.ResidService required a bean of type 'org.smilegate.repository.RedisRepository' that could not be found.


Action:

Consider defining a bean of type 'org.test.repository.RedisRepository' in your configuration.

Я искал ошибки и пробовал все, что получалось как решение. Я попытался добавить @Serice / @Component / @SpringBootApplication в RedisRepository И @Qutowired в RedisService 'redisrepository'

Однако, как ни старайся, ошибка не устраняется. Я хочу подключить Redis через RedisHashCommands.

Как я могу получить значение из 'весенней загрузки' через 'RedisHashCommands'? Пожалуйста, помогите ... пожалуйста;)

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...