Skip to content

Commit 98a3998

Browse files
authored
No jira dev deploy (#207)
* style: 엔터추가 * feat: DistributedLockAop 빈에서 삭제 * test: 리뷰 좋아요 테스트 주석처리 * feat: redis 설정 파일 주석 처리 * feat: 설정파일에서 redis 연결부분 삭제 * feat: redis 설정 다 삭제
1 parent 0ba293c commit 98a3998

File tree

5 files changed

+85
-88
lines changed

5 files changed

+85
-88
lines changed

infrastructure/build.gradle.kts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ dependencies {
2727
implementation("org.springframework.cloud:spring-cloud-starter-aws:_")
2828

2929
// redis
30-
implementation("org.springframework.boot:spring-boot-starter-data-redis:_")
31-
implementation("org.redisson:redisson-spring-boot-starter:_")
32-
implementation("it.ozimov:embedded-redis:_") {
33-
exclude(group = "org.slf4j", module = "slf4j-simple")
34-
because("테스트 환경에서 사용할 embedded-redis")
35-
}
30+
// implementation("org.springframework.boot:spring-boot-starter-data-redis:_")
31+
// implementation("org.redisson:redisson-spring-boot-starter:_")
32+
// implementation("it.ozimov:embedded-redis:_") {
33+
// exclude(group = "org.slf4j", module = "slf4j-simple")
34+
// because("테스트 환경에서 사용할 embedded-redis")
35+
// }
3636

3737
// webflux (HTTP 요청에 사용)
3838
implementation("org.springframework.boot:spring-boot-starter-webflux")
Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
1-
package org.depromeet.spot.infrastructure.common.aop;
2-
3-
import java.lang.reflect.Method;
4-
import java.util.Arrays;
5-
6-
import org.aspectj.lang.ProceedingJoinPoint;
7-
import org.aspectj.lang.annotation.Around;
8-
import org.aspectj.lang.annotation.Aspect;
9-
import org.aspectj.lang.reflect.MethodSignature;
10-
import org.depromeet.spot.common.annotation.DistributedLock;
11-
import org.depromeet.spot.infrastructure.common.util.SpringELParser;
12-
import org.redisson.api.RLock;
13-
import org.redisson.api.RedissonClient;
14-
15-
import lombok.RequiredArgsConstructor;
16-
import lombok.extern.slf4j.Slf4j;
17-
18-
@Slf4j
19-
@Aspect
1+
// package org.depromeet.spot.infrastructure.common.aop;
2+
//
3+
// import java.lang.reflect.Method;
4+
// import java.util.Arrays;
5+
//
6+
// import org.aspectj.lang.ProceedingJoinPoint;
7+
// import org.aspectj.lang.annotation.Around;
8+
// import org.aspectj.lang.annotation.Aspect;
9+
// import org.aspectj.lang.reflect.MethodSignature;
10+
// import org.depromeet.spot.common.annotation.DistributedLock;
11+
// import org.depromeet.spot.infrastructure.common.util.SpringELParser;
12+
// import org.redisson.api.RLock;
13+
// import org.redisson.api.RedissonClient;
14+
//
15+
// import lombok.RequiredArgsConstructor;
16+
// import lombok.extern.slf4j.Slf4j;
17+
//
18+
// @Slf4j
19+
// @Aspect
2020
// @Component
21-
@RequiredArgsConstructor
22-
public class DistributedLockAop {
23-
24-
private final RedissonClient redissonClient;
25-
private final TransactionAop aopForTransaction;
26-
27-
private static final String REDISSON_LOCK_PREFIX = "LOCK:";
28-
29-
@Around("@annotation(org.depromeet.spot.common.annotation.DistributedLock)")
30-
public Object lock(ProceedingJoinPoint joinPoint) throws Throwable {
31-
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
32-
Method method = signature.getMethod();
33-
DistributedLock distributedLock = method.getAnnotation(DistributedLock.class);
34-
35-
String lockKey = generateLockKey(signature, joinPoint.getArgs(), distributedLock);
36-
RLock rLock = redissonClient.getLock(lockKey);
37-
38-
try {
39-
if (!acquireLock(rLock, distributedLock)) {
40-
return false;
41-
}
42-
return aopForTransaction.proceed(joinPoint);
43-
} catch (InterruptedException e) {
44-
log.error(Arrays.toString(e.getStackTrace()));
45-
throw e;
46-
} finally {
47-
releaseLock(rLock);
48-
}
49-
}
50-
51-
private String generateLockKey(
52-
MethodSignature signature, Object[] args, DistributedLock distributeLock) {
53-
return REDISSON_LOCK_PREFIX
54-
+ SpringELParser.getDynamicValue(
55-
signature.getParameterNames(), args, distributeLock.key());
56-
}
57-
58-
private boolean acquireLock(RLock rLock, DistributedLock distributeLock)
59-
throws InterruptedException {
60-
return rLock.tryLock(
61-
distributeLock.waitTime(), distributeLock.leaseTime(), distributeLock.timeUnit());
62-
}
63-
64-
private void releaseLock(RLock rLock) {
65-
if (rLock != null && rLock.isHeldByCurrentThread()) {
66-
rLock.unlock();
67-
}
68-
}
69-
}
21+
// @RequiredArgsConstructor
22+
// public class DistributedLockAop {
23+
//
24+
// private final RedissonClient redissonClient;
25+
// private final TransactionAop aopForTransaction;
26+
//
27+
// private static final String REDISSON_LOCK_PREFIX = "LOCK:";
28+
//
29+
// @Around("@annotation(org.depromeet.spot.common.annotation.DistributedLock)")
30+
// public Object lock(ProceedingJoinPoint joinPoint) throws Throwable {
31+
// MethodSignature signature = (MethodSignature) joinPoint.getSignature();
32+
// Method method = signature.getMethod();
33+
// DistributedLock distributedLock = method.getAnnotation(DistributedLock.class);
34+
//
35+
// String lockKey = generateLockKey(signature, joinPoint.getArgs(), distributedLock);
36+
// RLock rLock = redissonClient.getLock(lockKey);
37+
//
38+
// try {
39+
// if (!acquireLock(rLock, distributedLock)) {
40+
// return false;
41+
// }
42+
// return aopForTransaction.proceed(joinPoint);
43+
// } catch (InterruptedException e) {
44+
// log.error(Arrays.toString(e.getStackTrace()));
45+
// throw e;
46+
// } finally {
47+
// releaseLock(rLock);
48+
// }
49+
// }
50+
//
51+
// private String generateLockKey(
52+
// MethodSignature signature, Object[] args, DistributedLock distributeLock) {
53+
// return REDISSON_LOCK_PREFIX
54+
// + SpringELParser.getDynamicValue(
55+
// signature.getParameterNames(), args, distributeLock.key());
56+
// }
57+
//
58+
// private boolean acquireLock(RLock rLock, DistributedLock distributeLock)
59+
// throws InterruptedException {
60+
// return rLock.tryLock(
61+
// distributeLock.waitTime(), distributeLock.leaseTime(), distributeLock.timeUnit());
62+
// }
63+
//
64+
// private void releaseLock(RLock rLock) {
65+
// if (rLock != null && rLock.isHeldByCurrentThread()) {
66+
// rLock.unlock();
67+
// }
68+
// }
69+
// }
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package org.depromeet.spot.infrastructure.redis;
2-
3-
import org.springframework.boot.context.properties.ConfigurationProperties;
4-
5-
@ConfigurationProperties(prefix = "aws.redis")
6-
public record RedisProperties(String host, int port) {}
1+
// package org.depromeet.spot.infrastructure.redis;
2+
//
3+
// import org.springframework.boot.context.properties.ConfigurationProperties;
4+
//
5+
// @ConfigurationProperties(prefix = "aws.redis")
6+
// public record RedisProperties(String host, int port) {}

infrastructure/src/main/resources/application-aws.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@ aws:
33
accessKey: ${AWS_ACCESS_KEY}
44
secretKey: ${AWS_SECRET_KEY}
55
bucketName: ${S3_BUCKET_NAME}
6-
basicProfileImageUrl: ${S3_BASIC_PROFILE_IMAGE_URL}
7-
redis:
8-
host: ${REDIS_HOST}
9-
port: ${REDIS_PORT}
6+
basicProfileImageUrl: ${S3_BASIC_PROFILE_IMAGE_URL}

versions.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ version.junit=5.9.1
2323

2424
version.org.projectlombok..lombok=1.18.30
2525

26-
version.org.redisson..redisson-spring-boot-starter=3.34.1
26+
#version.org.redisson..redisson-spring-boot-starter=3.34.1
2727

2828
version.org.springframework.boot..spring-boot-starter-test=3.0.1
2929

@@ -39,9 +39,9 @@ version.com.querydsl..querydsl-jpa=5.0.0
3939

4040
version.org.springframework.cloud..spring-cloud-starter-aws=2.2.6.RELEASE
4141

42-
version.org.springframework.boot..spring-boot-starter-data-redis=3.3.0
42+
#version.org.springframework.boot..spring-boot-starter-data-redis=3.3.0
4343

44-
version.org.redission..redisson-spring-boot-starter=3.26.0
44+
#version.org.redission..redisson-spring-boot-starter=3.26.0
4545

4646
version.org.springframework.boot..spring-boot-configuration-processor=3.0.1
4747

@@ -61,7 +61,7 @@ version.io.micrometer..micrometer-registry-prometheus=1.12.4
6161

6262
version.com.github.ben-manes.caffeine..caffeine=3.1.8
6363

64-
version.it.ozimov..embedded-redis=0.7.3
64+
#version.it.ozimov..embedded-redis=0.7.3
6565

6666
version.org.testcontainers..testcontainers=1.20.1
6767

0 commit comments

Comments
 (0)