From 8e7c61a3e102596ee7d2aaf04ba28025ef572f1c Mon Sep 17 00:00:00 2001 From: DongGeon0908 Date: Mon, 1 Jul 2024 11:28:45 +0900 Subject: [PATCH] fix: remove redis config --- .github/workflows/gradle.yml | 2 - build.gradle.kts | 1 - .../hero/alignlab/config/redis/RedisConfig.kt | 43 ------------------- .../com/hero/alignlab/exception/ErrorCode.kt | 1 - src/main/resources/config/application-dev.yml | 4 -- .../resources/config/application-prod.yml | 4 -- src/main/resources/config/application.yml | 5 --- 7 files changed, 60 deletions(-) delete mode 100644 src/main/kotlin/com/hero/alignlab/config/redis/RedisConfig.kt diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 915fa25..372bcde 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -47,8 +47,6 @@ jobs: with: files: ./src/main/resources/config/application-prod.yml env: - spring.data.redis.host: ${{ secrets.SPRING_REDIS_HOST }} - spring.data.redis.port: ${{ secrets.SPRING_REDIS_PORT }} hero.master.datasource.url: ${{ secrets.HERO_MASTER_DATASOURCE_URL }} hero.master.datasource.username: ${{ secrets.HERO_MASTER_DATASOURCE_USERNAME }} hero.master.datasource.password: ${{ secrets.HERO_MASTER_DATASOURCE_PASSWORD }} diff --git a/build.gradle.kts b/build.gradle.kts index ac3aa7a..7fba0aa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -56,7 +56,6 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter-actuator") implementation("org.springframework.boot:spring-boot-starter-validation") implementation("org.springframework.boot:spring-boot-starter-data-jpa") - implementation("org.springframework.boot:spring-boot-starter-data-redis-reactive") kapt("org.springframework.boot:spring-boot-configuration-processor") /** kotlin */ diff --git a/src/main/kotlin/com/hero/alignlab/config/redis/RedisConfig.kt b/src/main/kotlin/com/hero/alignlab/config/redis/RedisConfig.kt deleted file mode 100644 index e03c027..0000000 --- a/src/main/kotlin/com/hero/alignlab/config/redis/RedisConfig.kt +++ /dev/null @@ -1,43 +0,0 @@ -package com.hero.alignlab.config.redis - -import org.springframework.boot.autoconfigure.data.redis.RedisProperties -import org.springframework.boot.context.properties.EnableConfigurationProperties -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.Primary -import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory -import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory -import org.springframework.data.redis.core.ReactiveRedisTemplate -import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer -import org.springframework.data.redis.serializer.RedisSerializationContext -import org.springframework.data.redis.serializer.StringRedisSerializer - -@Configuration -@EnableConfigurationProperties(RedisProperties::class) -class RedisConfig( - private val properties: RedisProperties, -) { - /** - * Redis Config - * - non-cluster-mode - */ - @Bean - @Primary - fun reactiveRedisConnectionFactory(): ReactiveRedisConnectionFactory { - return LettuceConnectionFactory(properties.host, properties.port) - } - - @Bean - fun reactiveRedisTemplate(factory: ReactiveRedisConnectionFactory): ReactiveRedisTemplate { - val jdkSerializationRedisSerializer = JdkSerializationRedisSerializer() - val stringRedisSerializer = StringRedisSerializer.UTF_8 - - val redisSerializationContext = RedisSerializationContext - .newSerializationContext(jdkSerializationRedisSerializer) - .key(stringRedisSerializer) - .value(stringRedisSerializer) - .build() - - return ReactiveRedisTemplate(factory, redisSerializationContext) - } -} diff --git a/src/main/kotlin/com/hero/alignlab/exception/ErrorCode.kt b/src/main/kotlin/com/hero/alignlab/exception/ErrorCode.kt index 2f59d1d..c0fcd60 100644 --- a/src/main/kotlin/com/hero/alignlab/exception/ErrorCode.kt +++ b/src/main/kotlin/com/hero/alignlab/exception/ErrorCode.kt @@ -13,7 +13,6 @@ enum class ErrorCode(val status: HttpStatus, val description: String) { QUERY_DSL_NOT_EXISTS_ERROR(HttpStatus.NOT_FOUND, "not found query dsl"), COROUTINE_CANCELLATION_ERROR(HttpStatus.BAD_REQUEST, "coroutine cancellation error"), FAIL_TO_TRANSACTION_TEMPLATE_EXECUTE_ERROR(HttpStatus.BAD_REQUEST, "fail to tx-templates execute error"), - FAIL_TO_REDIS_EXECUTE_ERROR(HttpStatus.BAD_REQUEST, "fail to redis execute error"), /** short url */ NOT_FOUND_SHORT_URL(HttpStatus.NOT_FOUND, "not found short url"), diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index ceff65a..71548b6 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -28,10 +28,6 @@ spring: serialization: indent_output: true write-null-map-values: true - data: - redis: - host: localhost - port: 6379 # DEV-DATABASE-COMMON datasource: &dev-datasource diff --git a/src/main/resources/config/application-prod.yml b/src/main/resources/config/application-prod.yml index 45fb2f0..4e91998 100644 --- a/src/main/resources/config/application-prod.yml +++ b/src/main/resources/config/application-prod.yml @@ -28,10 +28,6 @@ spring: serialization: indent_output: true write-null-map-values: true - data: - redis: - host: - port: # DATABASE hero: diff --git a/src/main/resources/config/application.yml b/src/main/resources/config/application.yml index d232b92..2741095 100644 --- a/src/main/resources/config/application.yml +++ b/src/main/resources/config/application.yml @@ -19,11 +19,6 @@ spring: timeout-per-shutdown-phase: 5s # format : https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config-conversion-duration application: name: hero-alignlab-api - data: - redis: - repositories: - enabled: false - # DATABASE hero: