diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..2af6351 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,31 @@ +## #️⃣ Issue Number + + + +## 📝 요약(Summary) + + + +## 🛠️ PR 유형 + +어떤 변경 사항이 있나요? + +- [ ] 새로운 기능 추가 +- [ ] 버그 수정 +- [ ] CSS 등 사용자 UI 디자인 변경 +- [ ] 코드에 영향을 주지 않는 변경사항(오타 수정, 탭 사이즈 변경, 변수명 변경) +- [ ] 코드 리팩토링 +- [ ] 주석 추가 및 수정 +- [ ] 문서 수정 +- [ ] 테스트 추가, 테스트 리팩토링 +- [ ] 빌드 부분 혹은 패키지 매니저 수정 +- [ ] 파일 혹은 폴더명 수정 +- [ ] 파일 혹은 폴더 삭제 + +## 📸스크린샷 (선택) + +## 💬 공유사항 to 리뷰어 + + + + diff --git a/build.gradle.kts b/build.gradle.kts index e368428..e6e8def 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,6 +30,17 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter-web") testImplementation("org.springframework.boot:spring-boot-starter-test") testRuntimeOnly("org.junit.platform:junit-platform-launcher") + + implementation("org.springframework.boot:spring-boot-starter-data-jpa") + implementation("org.postgresql:postgresql") + + // Lombok (컴파일 타임 전용) + compileOnly("org.projectlombok:lombok") + annotationProcessor("org.projectlombok:lombok") + + // Lombok (테스트 환경) + testCompileOnly("org.projectlombok:lombok") + testAnnotationProcessor("org.projectlombok:lombok") } tasks.withType { diff --git a/src/main/java/com/cantech/batch/batch_service/test/TestController.java b/src/main/java/com/cantech/batch/batch_service/test/TestController.java new file mode 100644 index 0000000..3a85dd7 --- /dev/null +++ b/src/main/java/com/cantech/batch/batch_service/test/TestController.java @@ -0,0 +1,24 @@ +package com.cantech.batch.batch_service.test; + + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/test") +public class TestController { + + private final TestService testService; + + public TestController(TestService testService) { + this.testService = testService; + } + + @GetMapping + public List getAllTests() { + return testService.getAllTests(); + } +} \ No newline at end of file diff --git a/src/main/java/com/cantech/batch/batch_service/test/TestEntity.java b/src/main/java/com/cantech/batch/batch_service/test/TestEntity.java new file mode 100644 index 0000000..33e111c --- /dev/null +++ b/src/main/java/com/cantech/batch/batch_service/test/TestEntity.java @@ -0,0 +1,19 @@ +package com.cantech.batch.batch_service.test; + + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Table(name = "test") +@Getter +@NoArgsConstructor +public class TestEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String name; +} \ No newline at end of file diff --git a/src/main/java/com/cantech/batch/batch_service/test/TestRepository.java b/src/main/java/com/cantech/batch/batch_service/test/TestRepository.java new file mode 100644 index 0000000..56409b4 --- /dev/null +++ b/src/main/java/com/cantech/batch/batch_service/test/TestRepository.java @@ -0,0 +1,8 @@ +package com.cantech.batch.batch_service.test; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface TestRepository extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/cantech/batch/batch_service/test/TestService.java b/src/main/java/com/cantech/batch/batch_service/test/TestService.java new file mode 100644 index 0000000..9b9092f --- /dev/null +++ b/src/main/java/com/cantech/batch/batch_service/test/TestService.java @@ -0,0 +1,20 @@ +package com.cantech.batch.batch_service.test; + + +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class TestService { + + private final TestRepository testRepository; + + public TestService(TestRepository testRepository) { + this.testRepository = testRepository; + } + + public List getAllTests() { + return testRepository.findAll(); + } +} \ No newline at end of file diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties new file mode 100644 index 0000000..7e717be --- /dev/null +++ b/src/main/resources/application-dev.properties @@ -0,0 +1,5 @@ +eureka.client.service-url.defaultZone=${EUREKA_SERVER_URL} + +spring.datasource.url=${DATABASE_URL} +spring.datasource.username=${DATABASE_USERNAME} +spring.datasource.password=${DATABASE_PASSWORD} \ No newline at end of file diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties new file mode 100644 index 0000000..7e717be --- /dev/null +++ b/src/main/resources/application-prod.properties @@ -0,0 +1,5 @@ +eureka.client.service-url.defaultZone=${EUREKA_SERVER_URL} + +spring.datasource.url=${DATABASE_URL} +spring.datasource.username=${DATABASE_USERNAME} +spring.datasource.password=${DATABASE_PASSWORD} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 0408c42..c33a317 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1,11 @@ spring.application.name=batch-service +server.port=8083 + +eureka.client.register-with-eureka=true +eureka.client.fetch-registry=true + +spring.jpa.database=postgresql +spring.jpa.hibernate.ddl-auto=none +spring.jpa.show-sql=true + +spring.datasource.driver-class-name=org.postgresql.Driver \ No newline at end of file