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() {