Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
2029c68
feat: 필수기능 DDL sql 파일 추가
May 29, 2025
28ef7cd
fix: env 파일 gitignore 에 추가
May 29, 2025
b2cee95
refactor: application.yml 형식 통일
May 29, 2025
8f60806
feat: 도전 기능 DB 설계
May 29, 2025
8063b48
merge: 프로필 기능 병합
May 29, 2025
b0fe163
Merge branch 'develop' of https://github.com/Feeda-Project/spring-fee…
May 29, 2025
ae71810
feat: 게시물 기능 구현
joansdev May 29, 2025
032168d
Merge branch 'develop' of https://github.com/Feeda-Project/spring-fee…
joansdev May 29, 2025
5d716d5
refactor: env 관련 config 클래스, gitignore 추가
May 29, 2025
5ba0b76
feat: 프로필 연관 관계 추가
May 29, 2025
3b27775
feat: JWT payload 내용 변경
May 29, 2025
f9660b1
feat: controller 에서 JWT 사용 방식 변경
May 29, 2025
0bb5ec1
feat: 로그아웃 기능 구현
May 29, 2025
baee20c
fix: 예외 메시지 출력 오류 수정
May 29, 2025
030ae8c
fix: 회원 탈퇴 - 로직 오류 수정
May 29, 2025
30d165f
fix: 프로필 닉네임 중복 허용
May 30, 2025
4280b1f
fix: 프로필 닉네임 중복 불가
May 30, 2025
f7fd94c
feat: token 형식 검증 추가
May 30, 2025
b92b315
Merge pull request #21 from Feeda-Project/feature/14
Che0807 May 30, 2025
0faa5d5
merge: develop pull 후 충돌 처리
May 30, 2025
a725134
merge: develop pull 후 충돌 처리
May 30, 2025
70ea755
Merge pull request #17 from gajicoding/feature/15
gajicoding May 30, 2025
dafc9b4
fix: 회원 탈퇴 시 토큰 무효화
May 30, 2025
2f2016a
ì수refactor: ì서비스/레포지토리 ë 리 리팩토링
joansdev May 30, 2025
579b3b1
Merge pull request from Feeda-Project/feature/7
joansdev May 30, 2025
94648c7
Merge branch 'develop' of https://github.com/Feeda-Project/spring-fee…
May 30, 2025
f6fa584
refactor: 프로필 수정 조건 로직 서비스에서 처리하도록 변경
Che0807 May 30, 2025
1ab2228
Merge pull request #23 from Feeda-Project/bugfix/22
gajicoding May 30, 2025
6449e13
chore : JPA auto create 제거
leeuihyun May 30, 2025
ba7f2fa
merge: pull request #25 from Feeda-Project/refactor/24
Che0807 May 30, 2025
ef46e65
refactor : JwtPayload 타입 변경에 따른 수정
leeuihyun May 30, 2025
ea4402b
Merge branch 'develop' of https://github.com/Feeda-Project/spring-fee…
leeuihyun May 30, 2025
968fdfc
merge: develop 브랜치 병합
May 30, 2025
24c4665
Merge pull request #26 from Feeda-Project/feature/13
leeuihyun May 30, 2025
6f34c59
Merge branch 'develop' of https://github.com/Feeda-Project/spring-fee…
May 30, 2025
93e19f9
fix : 팔로우 버그 수정
leeuihyun May 30, 2025
1f2d63a
feat: 도전 기능 Entity, Repository 구현
May 30, 2025
7b3d79f
Merge pull request #29 from Feeda-Project/bugfix/27
leeuihyun May 30, 2025
b3babdf
Merge branch 'develop' of https://github.com/Feeda-Project/spring-fee…
May 30, 2025
a519fa4
Merge pull request #30 from Feeda-Project/feature/28
gajicoding May 30, 2025
6819c83
feat: 댓글 좋아요 기능 추가
May 30, 2025
eb51d18
Merge branch 'feature/33' of https://github.com/Feeda-Project/spring-…
May 30, 2025
fa44f65
feat : 팔로우 목록 조회 페이지네이션 비즈니스 로직
leeuihyun May 30, 2025
66c7456
feat : Pageable 객체를 사용하는 로직으로 변경
leeuihyun May 30, 2025
fab755b
refactor: schedule_comments 의 title 컬럼 삭제
May 30, 2025
ddcceeb
Merge pull request #34 from gajicoding/feature/33
gajicoding May 30, 2025
cb33f9b
Merge branch 'develop' of https://github.com/Feeda-Project/spring-fee…
leeuihyun May 30, 2025
f874fe3
feat: 댓글 CRUD 기능 구현 및 권한 검증 추가
Che0807 May 31, 2025
9576a15
Merge pull request #35 from Feeda-Project/feature/32
leeuihyun Jun 1, 2025
85be1c8
chore : H2 의존성 (테스트용), test yml 파일 작성
leeuihyun Jun 1, 2025
8418f9e
feat : Follow Test code 작성
leeuihyun Jun 1, 2025
c1aee9b
merge: comment-like 기능 병합 및 CommentController 충돌 해결
Che0807 Jun 1, 2025
905e729
Merge pull request #36 from Feeda-Project/feature/31
Che0807 Jun 1, 2025
fd1cd34
remove: 불필요한 파일 삭제
Jun 2, 2025
ad6d44d
refactor: 패키지 구조 통일
Jun 2, 2025
dcd2303
Merge pull request #38 from Feeda-Project/feature/37
leeuihyun Jun 2, 2025
e607185
docs: README 작성
Jun 2, 2025
4cdcf55
docs: README 작성
Jun 2, 2025
5bc45da
docs: README 업데이트
Jun 2, 2025
3e3da1b
docs: README 업데이트
Jun 2, 2025
bd816a4
Merge pull request #40 from gajicoding/refactor/39
gajicoding Jun 2, 2025
0fc13f8
docs: README 업데이트
Jun 2, 2025
a52eca5
Merge branch 'develop' of https://github.com/Feeda-Project/spring-fee…
Jun 2, 2025
b40709d
feat : Post Entity 생성자 수정
leeuihyun Jun 2, 2025
0e31c73
feat: 댓글 조회 API 구현 - 특정 게시글 전체 댓글 및 단건 댓글 조회 기능 추가
Che0807 Jun 2, 2025
d7433e3
feat : Post Controller 인증 객체 누락 수정
leeuihyun Jun 2, 2025
c76fe6c
feat : Post 비즈니스 로직 누락 로직 추가
leeuihyun Jun 2, 2025
b17c25a
feat : 팔로잉한 사람들의 게시글 조회 작성
leeuihyun Jun 2, 2025
8918b4e
feat: 프로필 조회 시 팔로잉, 팔로워 수 조회 기능 추가
Jun 2, 2025
2ec7dc5
Merge pull request #45 feature : 특정 게시글 전체 댓글 및 단건 댓글 조회 기능 추가
Che0807 Jun 2, 2025
947c789
Merge pull request #46 from Feeda-Project/feature/41
leeuihyun Jun 2, 2025
ffac3ed
Merge pull request #47 from gajicoding/issues/42
gajicoding Jun 2, 2025
11ce412
Merge branch 'develop' of https://github.com/Feeda-Project/spring-fee…
Jun 2, 2025
f13e1b5
게시글 좋아요 추가/제거
joansdev Jun 2, 2025
9a85f5a
Merge pull request #48 from gajicoding/feature/43
gajicoding Jun 2, 2025
1e8d383
Merge branch 'develop' of https://github.com/Feeda-Project/spring-fee…
joansdev Jun 2, 2025
9a3b2d9
refactor: 게시글 좋아요 제거: 조건부 + 예외처리
joansdev Jun 2, 2025
8c9bbd8
Merge pull request #51 from Feeda-Project/feature/50
joansdev Jun 2, 2025
f5c6c1b
feat : 기간 조회 로직 추가 (게시물)
leeuihyun Jun 2, 2025
303740b
feat : 병합 및 Post 응답 객체 comment 추가
leeuihyun Jun 2, 2025
43811c3
refactor : 기간 조회 코드 수정
leeuihyun Jun 2, 2025
7ffcefb
feat: 예외 처리 기능 구현
Jun 2, 2025
17a04ce
Merge pull request #52 from Feeda-Project/feature/49
leeuihyun Jun 2, 2025
2a1d2d2
merge: develop 업데이트 내용 pull
Jun 2, 2025
ec9e93d
merge: develop 업데이트 내용 pull
Jun 2, 2025
5f2e6fe
reactor: 추가된 내용 응답예외 수정
Jun 2, 2025
808ebdb
reactor: 추가된 내용 응답 예외 수정
Jun 2, 2025
469de8c
Merge pull request #54 from gajicoding/feature/53
gajicoding Jun 4, 2025
9e694db
fix: 전역 예외처리기 오류 해결
Jun 4, 2025
422608c
Merge pull request #55 from Feeda-Project/feature/53
gajicoding Jun 4, 2025
6d3262c
fix: 전체 api 테스트 후 에러 수정
Jun 4, 2025
bfc05d4
Merge branch 'develop' of https://github.com/Feeda-Project/spring-fee…
Jun 4, 2025
83b25ee
Merge pull request #57 from Feeda-Project/bugfix/56
gajicoding Jun 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ out/

### VS Code ###
.vscode/

/src/main/resources/properties/env.properties
/src/main/java/com/example/feeda/config/PropertyConfig.java
104 changes: 102 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,102 @@
# spring-feeda
모두가 모여 서로의 스터디 정보와 노하우를 나누는 커뮤니티 SNS입니다.
# 피다(Feeda)
개발자, 학생, 그리고 자기 계발에 관심 있는 모두가 모여 서로의 스터디 정보와 노하우를 나누는 커뮤니티 SNS입니다.

- 스터디 모집 및 경험 공유
- 질문과 답변을 통한 지식 나눔
- 성장과 동기부여를 위한 소통 공간
- 함께 배우고, 함께 성장하는 즐거움을 경험 시켜 드릴수가 있을 것 같습니다.

<br>

## 👨‍💻 Team
- 팀명: 6pring (식스프링)
- 소개: 4명의 아기자기한 팀
- 팀원 및 역할 분담

| 이름 | 역할 | 주요 담당 업무 |
|-----|----|------------------------------------------------------------------------------------------|
| 최경진 | 팀장 | - 발표 ✨<br>- 프로필 관련 API 개발<br>- 게시글 댓글 관련 API 개발 |
| 김나경 | 팀원 | - ERD 작성 및 DB 설계<br>- JWT 인증/인가 관련 기능 구현 <br>- 회원 관리 관련 API 개발<br>- 게시글 댓글 좋아요 관련 API 개발 |
| 안요한 | 팀원 | - 와이어 프레임 작성<br>- 게시글 관련 API 개발<br>- 게시글 좋아요 관련 API 개발 |
| 이의현 | 팀원 | - API 명세서 작성<br>- 팔로우(친구 관리) 관련 API 개발<br>- 전역 예외 처리 핸들러 개발<br>- 테스트 코드 작성 |


<br>

## 🛠 사용 기술
- Java 17
- Gradle 8.5
- Spring Boot 3.5.0
- Spring Data JPA (Hibernate 6.6.13.Final)
- Spring Security
- MySQL 8.0 이상
- Redis Cloud

<br>

## 💻 개발 도구
- IntelliJ IDEA
- Redis Insight
- Git
- Postman

<br>

## 📃 프로젝트 설계
<details>
<summary>API 명세서</summary>

Postman: [document](https://documenter.getpostman.com/view/44635744/2sB2qgeyJ7)

Notion
- [필수기능 명세서](https://www.notion.so/2002dc3ef5148050b741cdfba818f530?pvs=21)
- [도전기능 명세서](https://www.notion.so/2022dc3ef51481939541e86c62aa7864?pvs=21)
</details>

<details>
<summary>와이어 프레임</summary>

![와이어프레임](./images/wireframe.png)
</details>

<details>
<summary>DB 설계</summary>

- 개념적 설계:
- ![er](./images/er.png)
- 논리적 설계(ERD):
- ![erd](./images/erd.png)
- 물리적 설계(SQL):
- [newsFeed2.sql](./newsFeed2.sql)
- ![erdE](./images/erdE.png)
</details>

<br>

## 📁 폴더 구조
```bash
src
├──── main.java.com.example.feeda
│ ├──── config # 설정 관련
│ ├──── domain # 도메인별 기능 분류
│ │ ├──── account
│ │ ├──── comment
│ │ ├──── follow
│ │ ├──── post
│ │ └──── profile
│ ├──── exception # 예외 클래스 및 처리
│ ├──── filter # 인증 필터
│ ├──── security # 보안 관련 (PasswordEncoder, JWT)
│ └──── FeedaApplication.java
└──── test # 테스트 코드
```

<br>

## 🔍 새로운 지식


## 🧰 문제 해결 (트러블 슈팅)



56 changes: 30 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.5.0'
id 'io.spring.dependency-management' version '1.1.7'
id 'java'
id 'org.springframework.boot' version '3.5.0'
id 'io.spring.dependency-management' version '1.1.7'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
runtimeOnly 'com.mysql:mysql-connector-j'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

// jwt
compileOnly group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'
implementation 'mysql:mysql-connector-java:8.0.33' // 추가
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
runtimeOnly 'com.mysql:mysql-connector-j'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

// jwt
compileOnly group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'

testImplementation 'com.h2database:h2'
}

tasks.named('test') {
useJUnitPlatform()
useJUnitPlatform()
}
Binary file added images/er.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/erd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/erdE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/wireframe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions newsFeed.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
DROP DATABASE IF EXISTS newsFeed;
CREATE DATABASE IF NOT EXISTS newsFeed;
USE newsFeed;

-- 사용자 인증(accounts) 테이블 생성
CREATE TABLE accounts (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '사용자 인증 ID (PK)',
email VARCHAR(100) NOT NULL UNIQUE COMMENT '이메일',
password VARCHAR(255) NOT NULL COMMENT '비밀번호',
created_at DATETIME COMMENT '생성일',
updated_at DATETIME COMMENT '수정일'
) COMMENT = '사용자 인증 Table';

-- 사용자 정보(profile) 테이블 생성
CREATE TABLE profiles (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '사용자 정보 ID (PK)',
account_id BIGINT COMMENT '사용자 인증 ID (FK)',
nickname VARCHAR(50) NOT NULL UNIQUE COMMENT '닉네임',
birth DATE COMMENT '생년월일',
bio TEXT COMMENT '자기소개',
created_at DATETIME COMMENT '생성일',
updated_at DATETIME COMMENT '수정일',

FOREIGN KEY (account_id) REFERENCES accounts(id) ON DELETE CASCADE
) COMMENT = '사용자 정보 Table';

-- 게시글(posts) 테이블 생성
CREATE TABLE posts (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '게시글 ID (PK)',
profile_id BIGINT NOT NULL COMMENT '작성자 ID (FK)',
title VARCHAR(100) NOT NULL COMMENT '제목',
content TEXT NOT NULL COMMENT '내용',
category VARCHAR(50) COMMENT '카테고리',
created_at DATETIME COMMENT '생성일',
updated_at DATETIME COMMENT '수정일',

FOREIGN KEY (profile_id) REFERENCES profiles(id) ON DELETE CASCADE
) COMMENT = '게시글 Table';

-- 팔로우 목록(follows) 테이블 생성
CREATE TABLE follows (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '팔로우 ID (PK)',
follower_id BIGINT NOT NULL COMMENT '팔로우한 사람 ID (PK)',
following_id BIGINT NOT NULL COMMENT '팔로잉된 사람 ID (FK)',
created_at DATETIME COMMENT '생성일',

FOREIGN KEY (follower_id) REFERENCES profiles(id) ON DELETE CASCADE,
FOREIGN KEY (following_id) REFERENCES profiles(id) ON DELETE CASCADE
) COMMENT = '팔로우 목록 Table'
84 changes: 84 additions & 0 deletions newsFeed2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
DROP DATABASE IF EXISTS newsFeed;
CREATE DATABASE IF NOT EXISTS newsFeed;
USE newsFeed;

-- 사용자 인증(accounts) 테이블 생성
CREATE TABLE accounts (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '사용자 인증 ID (PK)',
email VARCHAR(100) NOT NULL UNIQUE COMMENT '이메일',
password VARCHAR(255) NOT NULL COMMENT '비밀번호',
created_at DATETIME COMMENT '생성일',
updated_at DATETIME COMMENT '수정일'
) COMMENT = '사용자 인증 Table';

-- 사용자 정보(profile) 테이블 생성
CREATE TABLE profiles (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '사용자 정보 ID (PK)',
account_id BIGINT COMMENT '사용자 인증 ID (FK)',
nickname VARCHAR(50) NOT NULL UNIQUE COMMENT '닉네임',
birth DATE COMMENT '생년월일',
bio TEXT COMMENT '자기소개',
created_at DATETIME COMMENT '생성일',
updated_at DATETIME COMMENT '수정일',

FOREIGN KEY (account_id) REFERENCES accounts(id) ON DELETE CASCADE
) COMMENT = '사용자 정보 Table';

-- 팔로우 목록(follows) 테이블 생성
CREATE TABLE follows (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '팔로우 ID (PK)',
follower_id BIGINT NOT NULL COMMENT '팔로우한 사람 ID (PK)',
following_id BIGINT NOT NULL COMMENT '팔로잉된 사람 ID (FK)',
created_at DATETIME COMMENT '생성일',

FOREIGN KEY (follower_id) REFERENCES profiles(id) ON DELETE CASCADE,
FOREIGN KEY (following_id) REFERENCES profiles(id) ON DELETE CASCADE
) COMMENT = '팔로우 목록 Table';

-- 게시글(posts) 테이블 생성
CREATE TABLE posts (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '게시글 ID (PK)',
profile_id BIGINT NOT NULL COMMENT '작성자 ID (FK)',
title VARCHAR(100) NOT NULL COMMENT '제목',
content TEXT NOT NULL COMMENT '내용',
category VARCHAR(50) COMMENT '카테고리',
created_at DATETIME COMMENT '생성일',
updated_at DATETIME COMMENT '수정일',

FOREIGN KEY (profile_id) REFERENCES profiles(id) ON DELETE CASCADE
) COMMENT = '게시글 Table';

-- 게시글 댓글(post_comments) 테이블 생성
CREATE TABLE post_comments (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '댓글 ID (PK)',
post_id BIGINT NOT NULL COMMENT '게시글 ID (FK)',
profile_id BIGINT NOT NULL COMMENT '작성자 ID (FK)',
content TEXT NOT NULL COMMENT '내용',
created_at DATETIME COMMENT '생성일',
updated_at DATETIME COMMENT '수정일',

FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE,
FOREIGN KEY (profile_id) REFERENCES profiles(id) ON DELETE CASCADE
) COMMENT = '게시글 댓글 Table';

-- 게시글 좋아요(post_likes) 테이블 생성
CREATE TABLE post_likes (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '댓글 ID (PK)',
post_id BIGINT NOT NULL COMMENT '게시글 ID (FK)',
profile_id BIGINT NOT NULL COMMENT '사용자 ID (FK)',
created_at DATETIME COMMENT '생성일',

FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE,
FOREIGN KEY (profile_id) REFERENCES profiles(id) ON DELETE CASCADE
) COMMENT = '게시글 좋아요 Table';

-- 게시글 댓글 좋아요(post_comment_likes) 테이블 생성
CREATE TABLE post_comment_likes (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '댓글 ID (PK)',
post_comment_id BIGINT NOT NULL COMMENT '게시글 ID (FK)',
profile_id BIGINT NOT NULL COMMENT '사용자 ID (FK)',
created_at DATETIME COMMENT '생성일',

FOREIGN KEY (post_comment_id) REFERENCES post_comments(id) ON DELETE CASCADE,
FOREIGN KEY (profile_id) REFERENCES profiles(id) ON DELETE CASCADE
) COMMENT = '게시글 댓글 좋아요 Table';
Empty file.
34 changes: 34 additions & 0 deletions src/main/java/com/example/feeda/config/RedisConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.example.feeda.config;

import org.springframework.context.annotation.Bean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;


@Configuration
@EnableRedisRepositories
public class RedisConfig {

@Value("${spring.data.redis.host}")
private String host;

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

@Value("${spring.data.redis.password:}")
private String password;

@Bean
public RedisConnectionFactory redisConnectionFactory() {
RedisStandaloneConfiguration config = new RedisStandaloneConfiguration();
config.setHostName(host);
config.setPort(port);
config.setPassword(password);

return new LettuceConnectionFactory(config);
}
}
Loading