From de120ed51805191abdb44b463b1670b9dad308e7 Mon Sep 17 00:00:00 2001 From: NARUBROWN Date: Sat, 13 Jul 2024 21:36:00 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]=20=EC=A0=84=EB=9E=B5=20=ED=8C=A8=ED=84=B4?= =?UTF-8?q?=EC=9D=B4=20=EC=A0=9C=EB=8C=80=EB=A1=9C=20=EB=8F=99=EC=9E=91?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8D=98=20=EB=AC=B8=EC=A0=9C?= =?UTF-8?q?=EB=A5=BC=20=ED=95=B4=EA=B2=B0=ED=95=A8=20#58?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../boardService/AdditionalBoardStrategyProviderImpl.java | 8 +++++++- .../kr/service/boardService/impl/FaqBoardServiceImpl.java | 2 +- .../service/boardService/impl/IntroBoardServiceImpl.java | 5 ++++- .../service/boardService/impl/PhotoBoardServiceImpl.java | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/server/inuappcenter/kr/service/boardService/AdditionalBoardStrategyProviderImpl.java b/src/main/java/server/inuappcenter/kr/service/boardService/AdditionalBoardStrategyProviderImpl.java index 6e19308..9819fd3 100644 --- a/src/main/java/server/inuappcenter/kr/service/boardService/AdditionalBoardStrategyProviderImpl.java +++ b/src/main/java/server/inuappcenter/kr/service/boardService/AdditionalBoardStrategyProviderImpl.java @@ -1,5 +1,7 @@ package server.inuappcenter.kr.service.boardService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import server.inuappcenter.kr.data.dto.response.BoardResponseDto; @@ -11,6 +13,7 @@ @Component public class AdditionalBoardStrategyProviderImpl implements AdditionalBoardStrategyProvider { + private static final Logger log = LoggerFactory.getLogger(AdditionalBoardStrategyProviderImpl.class); private final Map boardStrategyMap; @Autowired @@ -18,7 +21,8 @@ public AdditionalBoardStrategyProviderImpl(List addition this.boardStrategyMap = new HashMap<>(); for (AdditionalBoardService additionalBoardService : additionalBoardServices) { String key = additionalBoardService.getClass().getSimpleName().toLowerCase(); - this.boardStrategyMap.put(key, additionalBoardService); + int index = key.indexOf("$"); + this.boardStrategyMap.put(key.substring(0, index), additionalBoardService); } } @@ -31,7 +35,9 @@ public List findBoardList(String boardName, String topic) { @Override public List findBoardList(String boardName) { + log.info("getTest"); AdditionalBoardService additionalBoardService = boardStrategyMap.get(boardName.toLowerCase()); + System.out.println(additionalBoardService.getClass().getSimpleName()); return additionalBoardService.findBoardList(null); } } diff --git a/src/main/java/server/inuappcenter/kr/service/boardService/impl/FaqBoardServiceImpl.java b/src/main/java/server/inuappcenter/kr/service/boardService/impl/FaqBoardServiceImpl.java index 543ce6a..860ad15 100644 --- a/src/main/java/server/inuappcenter/kr/service/boardService/impl/FaqBoardServiceImpl.java +++ b/src/main/java/server/inuappcenter/kr/service/boardService/impl/FaqBoardServiceImpl.java @@ -14,7 +14,7 @@ import java.util.List; import java.util.stream.Collectors; -@Service +@Service("FaqBoardServiceImpl") @RequiredArgsConstructor @Slf4j public class FaqBoardServiceImpl implements AdditionalBoardService { diff --git a/src/main/java/server/inuappcenter/kr/service/boardService/impl/IntroBoardServiceImpl.java b/src/main/java/server/inuappcenter/kr/service/boardService/impl/IntroBoardServiceImpl.java index f87ad95..b354e6b 100644 --- a/src/main/java/server/inuappcenter/kr/service/boardService/impl/IntroBoardServiceImpl.java +++ b/src/main/java/server/inuappcenter/kr/service/boardService/impl/IntroBoardServiceImpl.java @@ -1,6 +1,7 @@ package server.inuappcenter.kr.service.boardService.impl; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import server.inuappcenter.kr.data.domain.board.Board; @@ -11,8 +12,9 @@ import java.util.ArrayList; import java.util.List; -@Service +@Service("IntroBoardServiceImpl") @RequiredArgsConstructor +@Slf4j public class IntroBoardServiceImpl implements AdditionalBoardService { private final IntroBoardRepository introBoardRepository; private final HttpServletRequest request; @@ -20,6 +22,7 @@ public class IntroBoardServiceImpl implements AdditionalBoardService { @Override @Transactional(readOnly = true) public List findBoardList(String topic) { + log.info("findBoardList"); List responseDtoList = new ArrayList<>(); for (Board board : introBoardRepository.findAll()) { responseDtoList.add(board.createResponse(request)); diff --git a/src/main/java/server/inuappcenter/kr/service/boardService/impl/PhotoBoardServiceImpl.java b/src/main/java/server/inuappcenter/kr/service/boardService/impl/PhotoBoardServiceImpl.java index 753b12a..2c807af 100644 --- a/src/main/java/server/inuappcenter/kr/service/boardService/impl/PhotoBoardServiceImpl.java +++ b/src/main/java/server/inuappcenter/kr/service/boardService/impl/PhotoBoardServiceImpl.java @@ -12,7 +12,7 @@ import java.util.ArrayList; import java.util.List; -@Service +@Service("PhotoBoardServiceImpl") @RequiredArgsConstructor @Slf4j public class PhotoBoardServiceImpl implements AdditionalBoardService {