File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
src/main/kotlin/com/wafflestudio/internhasha/config Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import org.springframework.beans.factory.annotation.Value
44import org.springframework.context.annotation.Bean
55import org.springframework.context.annotation.Configuration
66import org.springframework.data.redis.connection.RedisConnectionFactory
7+ import org.springframework.data.redis.connection.RedisStandaloneConfiguration
78import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory
89import org.springframework.data.redis.core.RedisTemplate
910import org.springframework.data.redis.serializer.StringRedisSerializer
@@ -12,10 +13,13 @@ import org.springframework.data.redis.serializer.StringRedisSerializer
1213class RedisConfig (
1314 @Value(" \$ {spring.data.redis.host}" ) private val redisHost : String ,
1415 @Value(" \$ {spring.data.redis.port}" ) private val redisPort : Int ,
16+ @Value(" \$ {spring.data.redis.database:0}" ) private val redisDatabase : Int ,
1517) {
1618 @Bean
1719 fun redisConnectionFactory (): RedisConnectionFactory {
18- return LettuceConnectionFactory (redisHost, redisPort)
20+ val config = RedisStandaloneConfiguration (redisHost, redisPort)
21+ config.database = redisDatabase
22+ return LettuceConnectionFactory (config)
1923 }
2024
2125 @Bean
You can’t perform that action at this time.
0 commit comments