From 1e8bf6a94523189049f9d459c739be7c6c4b30b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=A4=80=ED=97=8C?= Date: Tue, 18 Feb 2025 15:55:35 +0900 Subject: [PATCH 1/2] Refactor repository and study plan structure Removed redundancy in study plan documents and added detailed explanations for week 2 and 3 topics. Simplified `MemberCodeConverter` by removing `autoApply=true` attribute and cleaned up unused `create` method from `Member` entity. Restructured files for better organization. --- guide/github-action-test.md | 2 - plan/3. study_plan-curriculum.md | 20 ++++++-- plan/4.1. study_plan-week-1-summary.md | 17 ------- plan/4.1. study_plan-week-2-summary.md | 27 ----------- plan/4.2. study_plan-week-2-summary.md | 48 +++++++++++++++++++ plan/4.3. study_plan-week-3-summary.md | 27 +++++++++++ .../member/domain/entity/Member.java | 4 -- .../domain/mapping/MemberCodeConverter.java | 2 +- 8 files changed, 93 insertions(+), 54 deletions(-) delete mode 100644 guide/github-action-test.md delete mode 100644 plan/4.1. study_plan-week-2-summary.md create mode 100644 plan/4.2. study_plan-week-2-summary.md create mode 100644 plan/4.3. study_plan-week-3-summary.md diff --git a/guide/github-action-test.md b/guide/github-action-test.md deleted file mode 100644 index 8cda456..0000000 --- a/guide/github-action-test.md +++ /dev/null @@ -1,2 +0,0 @@ -# Github Action Test - diff --git a/plan/3. study_plan-curriculum.md b/plan/3. study_plan-curriculum.md index 68878e8..ba5b2ff 100644 --- a/plan/3. study_plan-curriculum.md +++ b/plan/3. study_plan-curriculum.md @@ -28,10 +28,24 @@ - **2.3.** JPA(Java Persistence API)를 이용한 DB 연동 - **2.3.1.** Entity 클래스 작성 - **2.3.2.** Repository 클래스 작성 - - **2.3.3.** Service 클래스 작성 - - **2.3.4.** Controller 클래스 작성 - +### 📅 3주차 +- **3.1.** JPA 심화 학습 + - **3.1.1.** Converter 사용 + - **3.1.2.** Embeddable 사용 + - **3.1.3.** Auditing 사용 + - **3.1.4.** ManyToOne, OneToMany 사용 +- **3.2.** Spring Boot 테스트 코드 작성 + - **3.2.1.** 단위 테스트 (Unit Test) 작성 + - **3.2.2.** 통합 테스트 (Integration Test) 작성 + - **3.2.3.** MockMvc 사용 +- **3.3.** RESTful API 설계 및 구현 + - **3.3.1.** RESTful API 기본 원칙 + - **3.3.2.** Request, Response DTO 클래스 작성 + - **3.3.3.** API 예외 처리 + - **3.3.4.** Spring Validation 사용 + - **3.3.5.** Converter 사용 + - **3.3.6.** Serializer/Deserializer 사용 diff --git a/plan/4.1. study_plan-week-1-summary.md b/plan/4.1. study_plan-week-1-summary.md index 445bc26..bc95e8a 100644 --- a/plan/4.1. study_plan-week-1-summary.md +++ b/plan/4.1. study_plan-week-1-summary.md @@ -24,23 +24,6 @@ - 객체지향 프로그래밍은 객체를 중심으로 프로그래밍하는 방법론입니다. 객체는 속성과 행위를 가지며, 객체 간의 상호작용을 통해 프로그램을 구성합니다. 객체지향 프로그래밍은 코드의 재사용성을 높이고, 유지보수성을 높입니다. - e.g. PhoneNumber 객체를 구현합니다. 멤버 변수로 국가번호, 지역번호, 전화번호를 가집니다. 이는 장점이 있습니다. 첫째, 전화번호를 한 번만 입력하면 객체가 전화번호를 분리하여 저장합니다. 둘째, 전화번호를 수정할 때 한 번만 수정하면 됩니다. 셋째, 전화번호를 출력할 때 객체가 전화번호를 조합하여 출력합니다. -### 📅 2주차 -- **2.1.** GitHub 저장소 생성 - - **2.1.1.** GitHub 저장소 생성 - - **2.1.2.** GitHub 저장소에 프로젝트 Push - - **2.1.3.** GitHub 저장소에 README.md 작성 - - **2.1.4.** GitHub 저장소에 .gitignore 작성 -- **2.2.** Docker를 이용한 로컬 DB 구성 및 Application 연동 - - **2.2.1.** Docker Desktop 설치 - - **2.2.2.** docker-compose.yml 작성 - - **2.2.3.** Docker 컨테이너 실행 - - **2.2.4.** Application과 DB 연동 -- **2.3.** JPA(Java Persistence API)를 이용한 DB 연동 - - **2.3.1.** Entity 클래스 작성 - - **2.3.2.** Repository 클래스 작성 - - **2.3.3.** Service 클래스 작성 - - **2.3.4.** Controller 클래스 작성 - diff --git a/plan/4.1. study_plan-week-2-summary.md b/plan/4.1. study_plan-week-2-summary.md deleted file mode 100644 index d8ba32a..0000000 --- a/plan/4.1. study_plan-week-2-summary.md +++ /dev/null @@ -1,27 +0,0 @@ -# 🖥️ 실습으로 익히는 모던 자바 프로그래밍 -## 📜 스터디 요약 -### 📅 2주차 -- **2.1.** GitHub 저장소 생성 - - **2.1.1.** GitHub 저장소 생성 - - **2.1.2.** GitHub 저장소에 프로젝트 Push - - **2.1.3.** GitHub 저장소에 README.md 작성 - - **2.1.4.** GitHub 저장소에 .gitignore 작성 -- **2.2.** Docker를 이용한 로컬 DB 구성 및 Application 연동 - - **2.2.1.** Docker Desktop 설치 - - **2.2.2.** docker-compose.yml 작성 - - **2.2.3.** Docker 컨테이너 실행 - - **2.2.4.** Application과 DB 연동 -- **2.3.** JPA(Java Persistence API)를 이용한 DB 연동 - - **2.3.1.** Entity 클래스 작성 - - **2.3.2.** Repository 클래스 작성 - - **2.3.3.** Service 클래스 작성 - - **2.3.4.** Controller 클래스 작성 - - - - - - - - - diff --git a/plan/4.2. study_plan-week-2-summary.md b/plan/4.2. study_plan-week-2-summary.md new file mode 100644 index 0000000..83699a2 --- /dev/null +++ b/plan/4.2. study_plan-week-2-summary.md @@ -0,0 +1,48 @@ +# 🖥️ 실습으로 익히는 모던 자바 프로그래밍 +## 📜 스터디 요약 +### 📅 2주차 +- **2.1.** GitHub 저장소 생성 + - **2.1.1.** GitHub 저장소 생성 + - **2.1.2.** GitHub 저장소에 프로젝트 Push + - **2.1.3.** GitHub 저장소에 README.md 작성 + - README.md는 프로젝트를 소개하는 문서입니다. 프로젝트의 목적, 사용법, 기술 스택 등을 소개합니다. + - **2.1.4.** GitHub 저장소에 .gitignore 작성 +- **2.2.** Docker를 이용한 로컬 DB 구성 및 Application 연동 + - [docker-compose-guide](../guide/docker-compose-guide.md) 참고 + - **2.2.1.** Docker Desktop 설치 + - **2.2.2.** docker-compose.yml 작성 + - **2.2.3.** Docker 컨테이너 실행 + - **2.2.4.** Application과 DB 연동 +- **2.3.** JPA(Java Persistence API)를 이용한 DB 연동 + - JPA는 Java Persistence API의 약자로, Java에서 데이터베이스를 사용하는 방법을 제공합니다. JPA를 사용하면 SQL을 직접 작성하지 않고, 객체를 통해 데이터베이스를 조작할 수 있습니다. + - **2.3.1.** Entity 클래스 작성 + - **2.3.2.** Repository 클래스 작성 + - JPA Query Method 사용 + - JPA Query Method를 사용하면 메소드 이름만으로 쿼리를 생성할 수 있습니다. 메소드 이름을 통해 쿼리를 생성하므로, 쿼리에 오타가 발생할 확률이 줄어듭니다. + - 실행 과정은 다음과 같습니다. + 1. JpaRepository 인터페이스를 상속받은 인터페이스를 생성합니다. Spring이 내부적으로 프록시 객체를 생성합니다. + ```java + public interface UserRepository extends JpaRepository { + User findByName(String name); + } + ``` + 위 코드가 실행되면 Spring은 UserRepository 인터페이스를 구현한 프록시 객체를 생성합니다. + ```java + public class UserRepository$$EnhancerBySpringCGLIB extends UserRepository { + @Override + public User findByName(String name) { + return this.invokeQueryMethod("findByName", name); + } + } + ``` + 2. 메소드 이름을 분석하여 JPQL([JPQL이란?](https://velog.io/@youmakemesmile/Spring-Data-JPA-JPQL-%EC%82%AC%EC%9A%A9-%EB%B0%A9%EB%B2%95Query-nativeQuery-DTO-Mapping-function)) 쿼리를 생성합니다. + 2. JPQL 쿼리를 실행하여 결과를 반환합니다. + + + + + + + + + diff --git a/plan/4.3. study_plan-week-3-summary.md b/plan/4.3. study_plan-week-3-summary.md new file mode 100644 index 0000000..43d8588 --- /dev/null +++ b/plan/4.3. study_plan-week-3-summary.md @@ -0,0 +1,27 @@ +# 🖥️ 실습으로 익히는 모던 자바 프로그래밍 +## 📜 스터디 요약 +### 📅 3주차 +- **3.1.** GitHub 저장소 생성 + - **3.1.1.** GitHub 저장소 생성 + - **3.1.2.** GitHub 저장소에 프로젝트 Push + - **3.1.3.** GitHub 저장소에 README.md 작성 + - **3.1.4.** GitHub 저장소에 .gitignore 작성 +- **3.2.** Docker를 이용한 로컬 DB 구성 및 Application 연동 + - **3.2.1.** Docker Desktop 설치 + - **3.2.2.** docker-compose.yml 작성 + - **3.2.3.** Docker 컨테이너 실행 + - **3.2.4.** Application과 DB 연동 +- **3.3.** JPA(Java Persistence API)를 이용한 DB 연동 + - **3.3.1.** Entity 클래스 작성 + - **3.3.2.** Repository 클래스 작성 + - **3.3.3.** Service 클래스 작성 + - **3.3.4.** Controller 클래스 작성 + + + + + + + + + diff --git a/spring-boot/src/main/java/com/mpc/springboot/member/domain/entity/Member.java b/spring-boot/src/main/java/com/mpc/springboot/member/domain/entity/Member.java index 6c65044..0e45e31 100644 --- a/spring-boot/src/main/java/com/mpc/springboot/member/domain/entity/Member.java +++ b/spring-boot/src/main/java/com/mpc/springboot/member/domain/entity/Member.java @@ -29,10 +29,6 @@ public Member(MemberCode code, MemberName name) { this.code = code; this.name = name; } - - public static Member create(MemberCode code, MemberName name) { - return new Member(code, name); - } } diff --git a/spring-boot/src/main/java/com/mpc/springboot/member/domain/mapping/MemberCodeConverter.java b/spring-boot/src/main/java/com/mpc/springboot/member/domain/mapping/MemberCodeConverter.java index ded5acf..26ccad3 100644 --- a/spring-boot/src/main/java/com/mpc/springboot/member/domain/mapping/MemberCodeConverter.java +++ b/spring-boot/src/main/java/com/mpc/springboot/member/domain/mapping/MemberCodeConverter.java @@ -7,7 +7,7 @@ import com.mpc.springboot.member.domain.vo.MemberCode; -@Converter(autoApply = true) +@Converter public class MemberCodeConverter implements AttributeConverter { @Override From f58342bac31a1aa3187e0e9ccb65060d2b128a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=A4=80=ED=97=8C?= Date: Tue, 18 Feb 2025 15:56:03 +0900 Subject: [PATCH 2/2] Refactor week 3 study plan summary sections. Updated the study plan to focus on advanced JPA concepts, Spring Boot testing, and RESTful API design. The changes ensure a more practical and comprehensive learning structure for the third week. --- plan/4.3. study_plan-week-3-summary.md | 31 +++++++++++++------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/plan/4.3. study_plan-week-3-summary.md b/plan/4.3. study_plan-week-3-summary.md index 43d8588..f9f35e9 100644 --- a/plan/4.3. study_plan-week-3-summary.md +++ b/plan/4.3. study_plan-week-3-summary.md @@ -1,21 +1,22 @@ # 🖥️ 실습으로 익히는 모던 자바 프로그래밍 ## 📜 스터디 요약 ### 📅 3주차 -- **3.1.** GitHub 저장소 생성 - - **3.1.1.** GitHub 저장소 생성 - - **3.1.2.** GitHub 저장소에 프로젝트 Push - - **3.1.3.** GitHub 저장소에 README.md 작성 - - **3.1.4.** GitHub 저장소에 .gitignore 작성 -- **3.2.** Docker를 이용한 로컬 DB 구성 및 Application 연동 - - **3.2.1.** Docker Desktop 설치 - - **3.2.2.** docker-compose.yml 작성 - - **3.2.3.** Docker 컨테이너 실행 - - **3.2.4.** Application과 DB 연동 -- **3.3.** JPA(Java Persistence API)를 이용한 DB 연동 - - **3.3.1.** Entity 클래스 작성 - - **3.3.2.** Repository 클래스 작성 - - **3.3.3.** Service 클래스 작성 - - **3.3.4.** Controller 클래스 작성 +- **3.1.** JPA 심화 학습 + - **3.1.1.** Converter 사용 + - **3.1.2.** Embeddable 사용 + - **3.1.3.** Auditing 사용 + - **3.1.4.** ManyToOne, OneToMany 사용 +- **3.2.** Spring Boot 테스트 코드 작성 + - **3.2.1.** 단위 테스트 (Unit Test) 작성 + - **3.2.2.** 통합 테스트 (Integration Test) 작성 + - **3.2.3.** MockMvc 사용 +- **3.3.** RESTful API 설계 및 구현 + - **3.3.1.** RESTful API 기본 원칙 + - **3.3.2.** Request, Response DTO 클래스 작성 + - **3.3.3.** API 예외 처리 + - **3.3.4.** Spring Validation 사용 + - **3.3.5.** Converter 사용 + - **3.3.6.** Serializer/Deserializer 사용