From 3bc22a3aeed1316831c44f28155d64ec45e4cb78 Mon Sep 17 00:00:00 2001 From: dltjdgh0428 Date: Mon, 8 Apr 2024 21:38:25 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Redis=20=EB=8F=84=EC=9E=85=EC=9D=84=20?= =?UTF-8?q?=ED=86=B5=ED=95=9C=20=EC=A2=8B=EC=95=84=EC=9A=94=20=EC=BA=90?= =?UTF-8?q?=EC=8B=B1=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- .../common/auth/config/SecurityConfig.java | 3 +-- .../common/jwt/filter/JwtFilter.java | 15 --------------- .../likes/service/LikesCachingServiceImpl.java | 3 +-- .../review/controller/ReviewController.java | 9 ++++----- 5 files changed, 7 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index 858d25a..e3dab2b 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ dependencies { runtimeOnly 'com.h2database:h2' } -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { options.compilerArgs += ['-parameters'] sourceCompatibility = '17' targetCompatibility = '17' diff --git a/src/main/java/com/book_everywhere/common/auth/config/SecurityConfig.java b/src/main/java/com/book_everywhere/common/auth/config/SecurityConfig.java index cdb1954..1d0582d 100644 --- a/src/main/java/com/book_everywhere/common/auth/config/SecurityConfig.java +++ b/src/main/java/com/book_everywhere/common/auth/config/SecurityConfig.java @@ -62,10 +62,9 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // .addFilterAfter(new JwtFilter(jwtProvider), UsernamePasswordAuthenticationFilter.class) .addFilterAfter(new JwtFilter(jwtProvider), OAuth2LoginAuthenticationFilter.class) .authorizeHttpRequests((authorizeRequests) -> authorizeRequests - .requestMatchers("/").permitAll() // 테스트 관련 url - .requestMatchers("/api/**").permitAll() +// .requestMatchers("/api/**").permitAll() .requestMatchers("/health", "/env", "/test/**", "/swagger-ui/**").permitAll() .requestMatchers("/api/reviews").permitAll() // 비회원도 볼수있는 url diff --git a/src/main/java/com/book_everywhere/common/jwt/filter/JwtFilter.java b/src/main/java/com/book_everywhere/common/jwt/filter/JwtFilter.java index 39b60e4..550d2af 100644 --- a/src/main/java/com/book_everywhere/common/jwt/filter/JwtFilter.java +++ b/src/main/java/com/book_everywhere/common/jwt/filter/JwtFilter.java @@ -29,21 +29,6 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse String authorization = null; Cookie[] cookies = request.getCookies(); - StringBuilder message = new StringBuilder(); - message.append("Request Method: ").append(request.getMethod()) - .append(", URL: ").append(request.getRequestURL()); - - // 헤더 정보 로깅 - Collections.list(request.getHeaderNames()).forEach(headerName -> - message.append(", ").append(headerName).append(": ").append(request.getHeader(headerName)) - ); - - // 파라미터 정보 로깅 (선택적) - request.getParameterMap().forEach((key, value) -> - message.append(", ").append(key).append(": ").append(Arrays.toString(value)) - ); - - logger.info(message.toString()); if (cookies != null) { for (Cookie cookie : cookies) { logger.info(cookie.toString()); diff --git a/src/main/java/com/book_everywhere/domain/likes/service/LikesCachingServiceImpl.java b/src/main/java/com/book_everywhere/domain/likes/service/LikesCachingServiceImpl.java index 1ee94b6..8610eeb 100644 --- a/src/main/java/com/book_everywhere/domain/likes/service/LikesCachingServiceImpl.java +++ b/src/main/java/com/book_everywhere/domain/likes/service/LikesCachingServiceImpl.java @@ -5,7 +5,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; @@ -19,7 +18,7 @@ public class LikesCachingServiceImpl implements LikesCachingService { @Override @Cacheable(value = "likesCount", key = "#reviewId") public Long 좋아요캐시업데이트(Long reviewId) { - logger.info(reviewId+"의 캐시가 없데이트 되었습니다."); + logger.info(reviewId+"의 캐시가 업데이트 되었습니다."); return likesRepository.countByReviewId(reviewId); } diff --git a/src/main/java/com/book_everywhere/domain/review/controller/ReviewController.java b/src/main/java/com/book_everywhere/domain/review/controller/ReviewController.java index eb468df..6666a02 100644 --- a/src/main/java/com/book_everywhere/domain/review/controller/ReviewController.java +++ b/src/main/java/com/book_everywhere/domain/review/controller/ReviewController.java @@ -1,6 +1,5 @@ package com.book_everywhere.domain.review.controller; - import com.book_everywhere.domain.book.service.BookService; import com.book_everywhere.domain.likes.service.LikesService; import com.book_everywhere.domain.pin.service.PinService; @@ -58,21 +57,21 @@ public CMRespDto addReview(@RequestBody ReviewRespDto reviewRespDto) { //공개 독후감 조회 @Operation(summary = "모든 독후감 조회", description = "조건에 없이 모든 독후감을 조회합니다 return = List") @GetMapping("/api/reviews") - public CMRespDto publicReviews(@RequestParam Long socialId) { + public CMRespDto publicReviews(@RequestParam(value = "socialId") Long socialId) { List result = reviewService.모든독후감조회(socialId); return new CMRespDto<>(HttpStatus.OK, result, "전체 공유 독후감 조회"); } @Operation(summary = "모든 공유 독후감 조회", description = "공유 독후감을 조회합니다 return = List") @GetMapping("/api/review/public") - public CMRespDto findPublicReviews(@RequestParam Long socialId) { + public CMRespDto findPublicReviews(@RequestParam(value = "socialId") Long socialId) { List result = reviewService.모든공유독후감조회(socialId); return new CMRespDto<>(HttpStatus.OK, result, "모든 공유 독후감 조회 완료"); } @Operation(summary = "단일 책 독후감 조회", description = "단일 책 독후감을 조회합니다 return = List") @GetMapping("/api/detail/{bookId}") - public CMRespDto bookReviews(@RequestParam Long socialId, @PathVariable Long bookId) { + public CMRespDto bookReviews(@RequestParam(value = "socialId") Long socialId, @PathVariable Long bookId) { List result = reviewService.책에따른모든리뷰(socialId, bookId); return new CMRespDto<>(HttpStatus.OK, result, "책에 따른 전체 독후감 조회"); } @@ -80,7 +79,7 @@ public CMRespDto bookReviews(@RequestParam Long socialId, @PathVariable Long //수정 @Operation(summary = "단일 독후감 조회", description = "특정 독후감을 조회합니다 return = ReviewDto") @GetMapping("/api/review/{reviewId}") - public CMRespDto getReview(@RequestParam Long socialId, @PathVariable Long reviewId) { + public CMRespDto getReview(@RequestParam(value = "socialId") Long socialId, @PathVariable Long reviewId) { ReviewDto reviewDto = reviewService.단일독후감조회(socialId, reviewId); return new CMRespDto<>(HttpStatus.OK, reviewDto, "단일 독후감 조회"); }