package com.kwan.springbootkwan.config; import lombok.Data; import org.redisson.Redisson; import org.redisson.api.RedissonClient; import org.redisson.config.Config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration @ConfigurationProperties(prefix = "spring.redis") @Data public class RedisTestConfig { private String host; private String port; private String password; @Bean public RedissonClient redissonClient() { Config config = new Config(); config.useSingleServer() .setAddress(String.format("redis://%s:%s", host, port)) .setPassword(password) .setConnectionPoolSize(50) .setIdleConnectionTimeout(10000) .setConnectTimeout(3000) .setTimeout(3000) .setDatabase(5); return Redisson.create(config); } }