Skip to content

Commit

Permalink
fix : Redis 의존성 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
YPYP333YPYP committed Jan 28, 2024
1 parent b8d3ee2 commit aadd851
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ dependencies {
// Swagger 의존성 추가
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.0.3'

// Redis 의존성 추가
implementation 'org.springframework.boot:spring-boot-starter-data-redis:3.1.5'

tasks.named('test') {
useJUnitPlatform()
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/com/example/ReviewZIP/global/config/RedisConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.example.ReviewZIP.global.config;

import org.springframework.beans.factory.annotation.Value;
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.repository.configuration.EnableRedisRepositories;

@EnableRedisRepositories
@Configuration
public class RedisConfig {
@Value("${spring.redis.host}")
private String redisHost;

@Value("${spring.redis.port}")
private int redisPort;

@Bean
public RedisConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisHost, redisPort);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.example.ReviewZIP.global.redis;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class RedisService {
}

0 comments on commit aadd851

Please sign in to comment.