Skip to content

Commit

Permalink
fix : (#15) Enable Redis keyspace notifications on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
kangeunchan committed Jan 14, 2025
1 parent 1fdf736 commit 1cd50e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ dependencies {
implementation("io.jsonwebtoken:jjwt-api:0.10.7")
runtimeOnly("io.jsonwebtoken:jjwt-impl:0.10.7")
runtimeOnly("io.jsonwebtoken:jjwt-jackson:0.10.7")

implementation("org.springframework.data:spring-data-redis")
implementation("org.springframework.boot:spring-boot-starter-data-redis")

implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.projectlombok:lombok")
testImplementation("org.springframework.boot:spring-boot-starter-test")
Expand All @@ -39,11 +42,11 @@ dependencies {
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
implementation("org.springframework.cloud:spring-cloud-starter-openfeign:4.2.0")

// vaildation
implementation("org.hibernate.validator:hibernate-validator:7.0.2.Final")
implementation("jakarta.validation:jakarta.validation-api:3.0.2")
}


kotlin {
compilerOptions {
freeCompilerArgs.addAll("-Xjsr305=strict")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.data.redis.connection.RedisConnectionFactory
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory
import org.springframework.data.redis.core.RedisKeyValueAdapter
import org.springframework.data.redis.core.RedisTemplate
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories
import org.springframework.data.redis.serializer.StringRedisSerializer

@EnableRedisRepositories
@EnableRedisRepositories(
enableKeyspaceEvents = RedisKeyValueAdapter.EnableKeyspaceEvents.ON_STARTUP,
keyspaceNotificationsConfigParameter = ""
)
@Configuration
class RedisConfig(
private val redisProperties: RedisProperties,
Expand All @@ -24,7 +28,6 @@ class RedisConfig(
return RedisTemplate<Any, Any>().apply {
this.setConnectionFactory(redisConnectionFactory())

// 불필요한 해시값을 숨기기 위한 serializer 설정
this.keySerializer = StringRedisSerializer()
this.hashKeySerializer = StringRedisSerializer()
this.valueSerializer = StringRedisSerializer()
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ spring:
redis:
host: ${REDIS_HOST}
port: ${REDIS_PORT}


jwt:
header: ${HEADER}
Expand Down

0 comments on commit 1cd50e9

Please sign in to comment.