From f100e11861d581d3844e41131c7a5fcdfec9e51d Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 7 Jul 2026 19:17:07 +0900 Subject: [PATCH] =?UTF-8?q?fix(community):=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EC=84=9C=EB=B9=84=EC=8A=A4=20=ED=8A=B8=EB=9E=9C=EC=9E=AD?= =?UTF-8?q?=EC=85=98=EC=9D=84=20=EC=9D=BD=EA=B8=B0=20=EC=A0=84=EC=9A=A9?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=8B=A4=ED=96=89=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creatorCommunity/CreatorCommunityService.kt | 1 + .../creatorCommunity/CreatorCommunityServiceTest.kt | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt index 96cd4fda..e75a7801 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt @@ -41,6 +41,7 @@ import java.time.LocalDateTime import java.time.ZoneId @Service +@Transactional(readOnly = true) class CreatorCommunityService( private val canPaymentService: CanPaymentService, diff --git a/src/test/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityServiceTest.kt b/src/test/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityServiceTest.kt index 48c91ca1..ad19b50e 100644 --- a/src/test/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityServiceTest.kt +++ b/src/test/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityServiceTest.kt @@ -35,6 +35,7 @@ import org.junit.jupiter.api.Test import org.mockito.ArgumentCaptor import org.mockito.Mockito import org.springframework.context.ApplicationEventPublisher +import org.springframework.transaction.annotation.Transactional import org.springframework.web.multipart.MultipartFile import java.io.InputStream import java.time.LocalDateTime @@ -234,6 +235,15 @@ class CreatorCommunityServiceTest { assertEquals("creator.community.invalid_request_retry", exception.messageKey) } + @Test + @DisplayName("커뮤니티 서비스 조회 메서드는 기본적으로 읽기 전용 트랜잭션으로 실행된다") + fun shouldRunCommunityServiceReadMethodsInReadOnlyTransaction() { + val transactional = CreatorCommunityService::class.java.getAnnotation(Transactional::class.java) + + assertNotNull(transactional) + assertTrue(transactional.readOnly) + } + @Test @DisplayName("고정 게시물이 이미 3개면 추가 고정 시 예외가 발생한다") fun shouldThrowExceptionWhenPinCountExceedsLimit() {