Skip to content

Commit

Permalink
fix: SecurityConfig 충돌 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
dltjdgh0428 committed Apr 8, 2024
2 parents aace410 + d2efb11 commit 5ad48f5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;

@EnableCaching
@SpringBootApplication
public class BookEverywhereApplication {
public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// 테스트 관련 url
.requestMatchers("/api/**").permitAll()
.requestMatchers("/health", "/env", "/test/**", "/swagger-ui/**").permitAll()
.requestMatchers("/api/reviews").permitAll()
// 비회원도 볼수있는 url
.requestMatchers("/api/review", "/api/map", "/api/tags", "/api/data/**").permitAll()
// 나머지
// .requestMatchers("/api/**").hasAuthority("ROLE_MEMBER")
// .anyRequest().authenticated()
.anyRequest().authenticated()
)
.oauth2Login(oauth2Login ->
oauth2Login
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@

import com.book_everywhere.domain.likes.repository.LikesRepository;
import lombok.RequiredArgsConstructor;
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;

@Service
@RequiredArgsConstructor
public class LikesCachingServiceImpl implements LikesCachingService {

private static final Logger logger = LoggerFactory.getLogger(LikesCachingServiceImpl.class);
private final LikesRepository likesRepository;

@Override
@CachePut(value = "likesCount", key = "#reviewId")
@Cacheable(value = "likesCount", key = "#reviewId")
public Long 좋아요캐시업데이트(Long reviewId) {
logger.info(reviewId+"의 캐시가 없데이트 되었습니다.");
return likesRepository.countByReviewId(reviewId);
}

Expand Down

0 comments on commit 5ad48f5

Please sign in to comment.