diff --git a/src/main/java/com/DecodEat/domain/products/service/ProductService.java b/src/main/java/com/DecodEat/domain/products/service/ProductService.java index 53dfadf..fee45f6 100644 --- a/src/main/java/com/DecodEat/domain/products/service/ProductService.java +++ b/src/main/java/com/DecodEat/domain/products/service/ProductService.java @@ -61,7 +61,6 @@ public class ProductService { public ProductDetailDto getDetail(Long id, User user) { Product product = productRepository.findById(id).orElseThrow(() -> new GeneralException(PRODUCT_NOT_EXISTED)); - if(user != null) userBehaviorService.saveUserBehavior(user,product, Behavior.VIEW); diff --git a/src/main/java/com/DecodEat/global/config/WebConfig.java b/src/main/java/com/DecodEat/global/config/WebConfig.java index 9ce29c5..eeb9d18 100644 --- a/src/main/java/com/DecodEat/global/config/WebConfig.java +++ b/src/main/java/com/DecodEat/global/config/WebConfig.java @@ -1,6 +1,7 @@ package com.DecodEat.global.config; import com.DecodEat.global.common.annotation.CurrentUserArgumentResolver; +import com.DecodEat.global.common.annotation.OptionalUserArgumentResolver; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Configuration; import org.springframework.web.method.support.HandlerMethodArgumentResolver; @@ -12,9 +13,11 @@ @RequiredArgsConstructor public class WebConfig implements WebMvcConfigurer { private final CurrentUserArgumentResolver currentUserArgumentResolver; - + private final OptionalUserArgumentResolver optionalUserArgumentResolver; @Override public void addArgumentResolvers(List resolvers){ resolvers.add(currentUserArgumentResolver); + resolvers.add(optionalUserArgumentResolver); } + }