From 2f2adebbf26146431cc30628c98493f56c404088 Mon Sep 17 00:00:00 2001 From: jini Date: Wed, 30 Nov 2022 04:55:12 +0900 Subject: [PATCH] =?UTF-8?q?:recycle:=20code=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../me/jiniworld/demohx/config/NoticeModule.kt | 17 ----------------- .../notice/{entity => }/NoticeEntity.kt | 2 +- .../notice/NoticePersistenceAdapter.kt | 1 - .../notice/{repository => }/NoticeRepository.kt | 5 +++-- .../me/jiniworld/demohx/DemoAppApplication.kt | 3 ++- 5 files changed, 6 insertions(+), 22 deletions(-) delete mode 100644 infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/config/NoticeModule.kt rename infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/{entity => }/NoticeEntity.kt (93%) rename infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/{repository => }/NoticeRepository.kt (66%) diff --git a/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/config/NoticeModule.kt b/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/config/NoticeModule.kt deleted file mode 100644 index 9b8d966..0000000 --- a/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/config/NoticeModule.kt +++ /dev/null @@ -1,17 +0,0 @@ -package me.jiniworld.demohx.config - -import org.springframework.boot.autoconfigure.domain.EntityScan -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration -import org.springframework.data.jpa.repository.config.EnableJpaRepositories - -@Configuration -@ComponentScan("me.jiniworld.demohx.persistence") -@EnableJpaRepositories(basePackages = ["me.jiniworld.demohx.persistence.notice.repository"]) -@EntityScan(basePackages = ["me.jiniworld.demohx.persistence.notice.entity"]) -class NoticeModule { -// @Bean -// fun noticePersistenceAdapter(noticeRepository: NoticeRepository): NoticePersistenceAdapter { -// return NoticePersistenceAdapter(noticeRepository) -// } -} \ No newline at end of file diff --git a/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/entity/NoticeEntity.kt b/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/NoticeEntity.kt similarity index 93% rename from infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/entity/NoticeEntity.kt rename to infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/NoticeEntity.kt index 5e8a1c7..96e1d41 100644 --- a/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/entity/NoticeEntity.kt +++ b/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/NoticeEntity.kt @@ -1,4 +1,4 @@ -package me.jiniworld.demohx.persistence.notice.entity +package me.jiniworld.demohx.persistence.notice import me.jiniworld.demohx.application.notice.domain.Notice import org.springframework.data.annotation.CreatedDate diff --git a/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/NoticePersistenceAdapter.kt b/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/NoticePersistenceAdapter.kt index b30d3f9..27fe872 100644 --- a/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/NoticePersistenceAdapter.kt +++ b/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/NoticePersistenceAdapter.kt @@ -3,7 +3,6 @@ package me.jiniworld.demohx.persistence.notice import me.jiniworld.demohx.annotation.PersistenceAdapter import me.jiniworld.demohx.application.notice.domain.Notice import me.jiniworld.demohx.application.notice.port.output.LoadNoticePort -import me.jiniworld.demohx.persistence.notice.repository.NoticeRepository import org.springframework.data.domain.Pageable import org.springframework.data.repository.findByIdOrNull diff --git a/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/repository/NoticeRepository.kt b/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/NoticeRepository.kt similarity index 66% rename from infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/repository/NoticeRepository.kt rename to infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/NoticeRepository.kt index 956465d..bde7a99 100644 --- a/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/repository/NoticeRepository.kt +++ b/infrastructure/datastore-mariadb/src/main/kotlin/me/jiniworld/demohx/persistence/notice/NoticeRepository.kt @@ -1,9 +1,10 @@ -package me.jiniworld.demohx.persistence.notice.repository +package me.jiniworld.demohx.persistence.notice -import me.jiniworld.demohx.persistence.notice.entity.NoticeEntity import org.springframework.data.domain.Pageable import org.springframework.data.jpa.repository.JpaRepository +import org.springframework.stereotype.Repository +@Repository internal interface NoticeRepository: JpaRepository { fun findAllBy(pageable: Pageable): List } \ No newline at end of file diff --git a/server/demo-app/src/main/kotlin/me/jiniworld/demohx/DemoAppApplication.kt b/server/demo-app/src/main/kotlin/me/jiniworld/demohx/DemoAppApplication.kt index fff1dae..d9138f3 100644 --- a/server/demo-app/src/main/kotlin/me/jiniworld/demohx/DemoAppApplication.kt +++ b/server/demo-app/src/main/kotlin/me/jiniworld/demohx/DemoAppApplication.kt @@ -7,7 +7,8 @@ import java.util.* @SpringBootApplication(scanBasePackages = [ "me.jiniworld.demohx.config", "me.jiniworld.demohx.web", - "me.jiniworld.demohx.application" + "me.jiniworld.demohx.application", + "me.jiniworld.demohx.persistence" ]) class DemoAppApplication