Skip to content

Commit 2cb9f3b

Browse files
committed
refactor: 명시적인 생성자 제거및 어노테이션 대체
- ParameterExtractor의 생성자 코드 제거및 RequiredArgs 어노테이션 추가 - ResponseExtractor의 생성자 코드 제거및 RequiredArgs 어노테이션 추가 - SensitiveDataMasker의 불필요한 어노테이션 제거
1 parent 7fa86a9 commit 2cb9f3b

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

src/main/java/com/somemore/global/aspect/log/extractor/ParameterExtractor.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.fasterxml.jackson.core.JsonProcessingException;
44
import com.fasterxml.jackson.databind.ObjectMapper;
55
import com.somemore.global.aspect.log.utils.SensitiveDataMasker;
6+
import lombok.RequiredArgsConstructor;
67
import lombok.extern.slf4j.Slf4j;
78
import org.aspectj.lang.ProceedingJoinPoint;
89
import org.aspectj.lang.reflect.MethodSignature;
@@ -14,18 +15,14 @@
1415
import java.util.LinkedHashMap;
1516
import java.util.Map;
1617

18+
@RequiredArgsConstructor
1719
@Slf4j
1820
@Component
1921
public class ParameterExtractor {
2022

2123
private final ObjectMapper objectMapper;
2224
private final SensitiveDataMasker sensitiveDataMasker;
2325

24-
public ParameterExtractor(ObjectMapper objectMapper) {
25-
this.objectMapper = objectMapper;
26-
this.sensitiveDataMasker = new SensitiveDataMasker();
27-
}
28-
2926
public String extractParameters(ProceedingJoinPoint joinPoint) {
3027
try {
3128
MethodSignature signature = (MethodSignature) joinPoint.getSignature();

src/main/java/com/somemore/global/aspect/log/extractor/ResponseExtractor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@
66
import com.somemore.global.exception.ImageUploadException;
77
import com.somemore.global.exception.BadRequestException;
88
import com.somemore.global.exception.NoSuchElementException;
9+
import lombok.RequiredArgsConstructor;
910
import lombok.extern.slf4j.Slf4j;
1011
import org.springframework.http.HttpStatus;
1112
import org.springframework.http.ResponseEntity;
1213
import org.springframework.stereotype.Component;
1314
import org.springframework.web.bind.MethodArgumentNotValidException;
1415

16+
@RequiredArgsConstructor
1517
@Slf4j
1618
@Component
1719
public class ResponseExtractor {
1820

1921
private final ObjectMapper objectMapper;
2022

21-
public ResponseExtractor(ObjectMapper objectMapper) {
22-
this.objectMapper = objectMapper;
23-
}
24-
2523
public LoggedResponse extractResponse(Object result) {
2624
try {
2725
if (result == null) {

src/main/java/com/somemore/global/aspect/log/utils/SensitiveDataMasker.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
import com.fasterxml.jackson.core.JsonProcessingException;
44
import com.fasterxml.jackson.databind.ObjectMapper;
5-
import lombok.RequiredArgsConstructor;
65
import lombok.extern.slf4j.Slf4j;
76
import org.springframework.stereotype.Component;
87

98
import java.util.*;
109

11-
@RequiredArgsConstructor
1210
@Slf4j
1311
@Component
1412
public class SensitiveDataMasker {

0 commit comments

Comments
 (0)