title: Unable to store session in Redis using Java Spring Boot Session Data Redis
body: <p>I think I have problems saving session information in Redis. I've tried to follow the instruction about <code>spring-session-data-redis</code>, but I can't find any session information within redis when I start a request. The following is my code and config.</p>
  
  <p>application.properties file:</p>
  
  <pre><code>spring.session.store-type=redis
  spring.session.redis.flush-mode= on-save
  spring.session.redis.namespace= spring:session
  spring.redis.host= 10.10.10.10
  spring.redis.port=10000
  </code></pre>
  
  <p>pom.xml:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.springframework.session&lt;/groupId&gt;
      &lt;artifactId&gt;spring-session-data-redis&lt;/artifactId&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;redis.clients&lt;/groupId&gt;
      &lt;artifactId&gt;jedis&lt;/artifactId&gt;
      &lt;version&gt;2.9.0&lt;/version&gt;
      &lt;type&gt;jar&lt;/type&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Application Configuration class:</p>
  
  <pre><code>@Configuration
  @EnableRedisHttpSession
  @PropertySource("application.properties")
  public class AppConfig {
  
      @Value("${spring.redis.host}")
      private String redisHostName;
  
      @Value("${spring.redis.port}")
      private int redisPort;
  
      @Bean
      JedisConnectionFactory jedisConnectionFactory() {
          RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(
                  redisHostName, redisPort);
          return new JedisConnectionFactory(redisStandaloneConfiguration);
      }
  }
  </code></pre>
  
  <p>And my sample Get request controller:</p>
  
  <pre><code>// test only
      @CrossOrigin
      @GetMapping(value = "/test/test")
      public String justTest(HttpServletRequest request) {
          HttpSession session = request.getSession();
          session.setAttribute("sessionId", "ssssss");
  
          String value = (String) session.getAttribute("sessionId").toString();
          return value;
      }
  </code></pre>
  
  <p>Am I missing something? The <code>spring-session-data-redis</code> is supposed to store session to Redis automatically, but it seems not acting like that. Do I need <code>spring-session</code> dependency and <code>spring-data-redis</code> dependency? The redis connection is ok, I set it to listen to all interfaces.</p>
  
  <p>It seems I can retrieve the session id when I start a request, but why the session is not inserted into Redis?</p>