@@ -0,0 +1,3313 @@
+package com.rizki.mufrizal.spring.oauth2.custom.configuration;%0A%0Aimport java.time.Duration;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.context.annotation.Bean;%0Aimport org.springframework.context.annotation.Configuration;%0Aimport org.springframework.context.annotation.PropertySource;%0Aimport org.springframework.core.env.Environment;%0Aimport org.springframework.data.redis.connection.jedis.JedisConnectionFactory;%0Aimport org.springframework.data.redis.core.RedisTemplate;%0Aimport org.springframework.data.redis.serializer.GenericToStringSerializer;%0Aimport org.springframework.data.redis.serializer.StringRedisSerializer;%0Aimport org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;%0Aimport redis.clients.jedis.JedisPoolConfig;%0A%0A/**%0A *%0A * @Author Rizki Mufrizal %3Cmufrizalrizki@gmail.com%3E%0A * @Web %3Chttps://RizkiMufrizal.github.io%3E%0A * @Since Apr 16, 2017%0A * @Time 11:04:20 AM%0A * @Encoding UTF-8%0A * @Project Spring-OAuth2-Custom%0A * @Package com.rizki.mufrizal.spring.oauth2.custom.configuration%0A *%0A */%0A@Configuration%0A@PropertySource(%22classpath:application.yml%22)%0A@EnableRedisHttpSession%0Apublic class RedisSessionConfiguration %7B%0A%0A    @Autowired%0A    private Environment environment;%0A%0A    private JedisPoolConfig jedisPoolConfig() %7B%0A        final JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();%0A        jedisPoolConfig.setMaxTotal(Integer.parseInt(environment.getRequiredProperty(%22spring.redis.max-total%22)));%0A        jedisPoolConfig.setMaxIdle(Integer.parseInt(environment.getRequiredProperty(%22spring.redis.max-idle%22)));%0A        jedisPoolConfig.setMinIdle(Integer.parseInt(environment.getRequiredProperty(%22spring.redis.min-idle%22)));%0A        jedisPoolConfig.setMinEvictableIdleTimeMillis(Duration.ofSeconds(Integer.parseInt(environment.getRequiredProperty(%22spring.redis.min-evictable-idle-time-millis%22))).toMillis());%0A        jedisPoolConfig.setTimeBetweenEvictionRunsMillis(Duration.ofSeconds(Integer.parseInt(environment.getRequiredProperty(%22spring.redis.time-between-eviction-runs-millis%22))).toMillis());%0A        jedisPoolConfig.setBlockWhenExhausted(Boolean.valueOf(environment.getRequiredProperty(%22spring.redis.block-when-exhausted%22)));%0A        return jedisPoolConfig;%0A    %7D%0A%0A    @Bean%0A    public JedisConnectionFactory jedisConnectionFactory() %7B%0A        JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory(jedisPoolConfig());%0A        jedisConnectionFactory.setPort(Integer.parseInt(environment.getRequiredProperty(%22spring.redis.port%22)));%0A        jedisConnectionFactory.setHostName(environment.getRequiredProperty(%22spring.redis.host%22));%0A        jedisConnectionFactory.setUsePool(Boolean.valueOf(environment.getRequiredProperty(%22spring.redis.use-pool%22)));%0A        return jedisConnectionFactory;%0A    %7D%0A%0A    @Bean%0A    RedisTemplate%3C String, Object%3E redisTemplate() %7B%0A        final RedisTemplate%3C String, Object%3E redisTemplate = new RedisTemplate%3C%3E();%0A        redisTemplate.setConnectionFactory(jedisConnectionFactory());%0A        redisTemplate.setKeySerializer(new StringRedisSerializer());%0A        redisTemplate.setHashValueSerializer(new GenericToStringSerializer%3C%3E(Object.class));%0A        redisTemplate.setValueSerializer(new GenericToStringSerializer%3C%3E(Object.class));%0A        return redisTemplate;%0A    %7D%0A%0A%7D%0A

add configuration redis and redis session