title: Redis Issue Consider defining a bean of type 'org.springframework.data.redis.core.HashOperations' in your configuration
body: <p>I am trying to connect to Redis through java, I have following configuration,</p>
  
  <pre><code>@SpringBootApplication
  @Configuration
  @ComponentScan(basePackages = "com.infy.redisDemo")
  public class RedisDemoApplication {
  
      @Bean
      public LettuceConnectionFactory getConnectionFactory(){
          LettuceConnectionFactory lettuceConnectionFactory = new LettuceConnectionFactory("localhost",6379);
          return lettuceConnectionFactory;
      }
  
      @Bean
      public RedisTemplate&lt;String,Object&gt; getRedisTemplate(){
          RedisTemplate&lt;String, Object&gt; redisTemplate = new RedisTemplate();
          redisTemplate.setConnectionFactory(getConnectionFactory());
          return redisTemplate;
      }
  
      public static void main(String[] args) {
          SpringApplication.run(RedisDemoApplication.class, args);
      }
  
  }
  </code></pre>
  
  <p>My repo classes :</p>
  
  <pre><code>@Repository
  public class UserRepoImpl implements UserRepository {
  
      private RedisTemplate&lt;String, Object&gt; redisTemplate;
      private HashOperations hashOperations;
  
      public final String key = "USER";
  
      public UserRepoImpl(RedisTemplate redisTemplate,
        HashOperations hashOperations) {
          this.redisTemplate = redisTemplate;
          this.hashOperations = redisTemplate.opsForHash();
      }
  
      @Override
      public void save(User user) {
          hashOperations.put(key,user.getId(),user);
      }
  
      @Override
      public void update(User user) {
          hashOperations.put(key,user.getId(),user);
      }
  
      @Override
      public Map findAll() {
          return hashOperations.entries(key);
      }
  }
  
  public interface UserRepository {
      void save(User user);
      void update(User user);
      Map findAll();
  }
  </code></pre>
  
  <p>My Controller class as below,</p>
  
  <pre><code>@RestController
  @RequestMapping("/rest/user")
  public class RedisController {
      private UserRepository userRepository;
  
      public RedisController(UserRepository userRepository) {
          this.userRepository = userRepository;
      }
  
      @GetMapping("/add/{id}/{name}")
      public User add(@PathVariable String id,@PathVariable String name){
          userRepository.save(new User(name,id,25000));
          return userRepository.findById(id);
      }
  }
  </code></pre>
  
  <p>When I am running the app I am getting following error,</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisController' defined in file [redisDemo\RedisController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userRepoImpl' defined in file [redisDemo\repository\UserRepoImpl.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.data.redis.core.HashOperations' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}</p>
  </blockquote>
  
  <p>whats wrong in the program ? any suggestion to make it work ? do I need to use  jedisconnectionFactory ? I am using Intellij and my version for <strong>redis is 3.2</strong> on windows and <strong>spring is 2.1.6</strong>. </p>