title: Spring Redis - Read configuration from application.properties file
body: <p>I have Spring Redis working using <code>spring-data-redis</code> with all default configuration likes <code>localhost</code> default <code>port</code> and so on.</p>
  <p>Now I am trying to make the same configuration by configuring it in <code>application.properties</code> file. But I cannot figure out how should I create beans exactly that my property values are read.</p>
  <p>Redis Configuration File</p>
  <pre><code>@EnableRedisHttpSession
  @Configuration
  public class SpringSessionRedisConfiguration {
  
  @Bean
  JedisConnectionFactory connectionFactory() {
      return new JedisConnectionFactory();
  }
  
  @Autowired
  @Bean
  RedisCacheManager redisCacheManager(final StringRedisTemplate stringRedisTemplate) {
      return new RedisCacheManager(stringRedisTemplate);
  }
  
  @Autowired
  @Bean
  StringRedisTemplate template(final RedisConnectionFactory connectionFactory) {
      return new StringRedisTemplate(connectionFactory);
  }
  }
  </code></pre>
  <p>Standard Parameters in application.properties</p>
  <blockquote>
  <p>spring.redis.sentinel.master=themaster</p>
  <p>spring.redis.sentinel.nodes=192.168.188.231:26379</p>
  <p>spring.redis.password=12345</p>
  </blockquote>
  <p>What I tried,</p>
  <ol>
  <li>I can possibly use <code>@PropertySource</code> and then inject <code>@Value</code> and get the values. But I don't want to do that as those properties are not defined by me but are from Spring.</li>
  <li>In this documentation <a href="http://docs.spring.io/spring-data/data-redis/docs/current/reference/pdf/spring-data-redis-reference.pdf" rel="noreferrer">Spring Redis Documentation</a>, it only says that it can be configured using properties but doesn't show concrete example.</li>
  <li>I also went through Spring Data Redis API classes, and found that <code>RedisProperties</code> should help me, but still cannot figure out how exactly to tell Spring to read from properties file.</li>
  </ol>