Skip to content

[23기_최우혁] spring tutorial 미션 제출합니다.#1

Open
whc9999 wants to merge 1 commit intoCEOS-Developers:whc9999from
whc9999:feat/1st-mission
Open

[23기_최우혁] spring tutorial 미션 제출합니다.#1
whc9999 wants to merge 1 commit intoCEOS-Developers:whc9999from
whc9999:feat/1st-mission

Conversation

@whc9999
Copy link

@whc9999 whc9999 commented Mar 12, 2026

No description provided.

Comment on lines +26 to +28
jpa 설정의 들여쓰기를 잘못하여 jpa가 datasource 안에 포함되게 하였다. 이 때문에 스프링이 jpa 설정을 인식하지 못하여 `ddl-auto` 설정이 동작하지 않았다. 들여쓰기를 수정하여 스프링 설정에서 jpa와 datasource가 서로 동등한 계층에 있도록 했다. 따라서 jpa 설정이 정상 작동하고, 테이블이 자동으로 생성되게 되었다.

이런 들여쓰기 실수는 간단하지만 치명적일 수 있다는 것을 느꼈다. 특히 설정파일에서의 실수는 빌드 시에도 오류가 나타나지 않기 때문에 알아차리기도 쉽지 않다. 따라서 이런 부분을 조금 더 신경을 쓸 수 있도록 해야겠다는 생각을 했다. 또한 오류의 원인을 찾으면서 `ddl-auto` 설정의 위험성(?)에 대해서도 다시 공부할 수 있어서 좋았다.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 들여쓰기 실수 정말 많이 하는데, 나중에 비슷한 문제가 생기면 .yml 파일 들여쓰기부터 확인해봐야겠네요 ㅠㅠ
새로운 정보 알게해주셔서 감사합니다 👍

Comment on lines +164 to +166
추가: 스터디에서 Bean 관련 설명 중, Bean 수동 등록 시, `@Configuration` 클래스 안에서 의도적으로 `@Bean` 을 생략하고 순수 자바의 `new` 키워드로 객체를 생성할 때가 있지 않을까란 의문이 생겼다.

실제로도 그런 경우가 존재한다. 모든 객체에 `@Bean` 을 붙여 스프링 컨테이너에 올리면 싱글톤으로 관리되며 애플리케이션 전역에서 주입받을 수 있게 된다. 하지만 굳이 다른 곳에서는 안 쓰고 오직 해당 클래스 내부에서만 사용된다면, 스프링에게 관리하라고 던져줄 필요 없이 개발자가 직접 `new` 로 생성해서 쓰고 버리는(가비지 컬렉터에게 맡기기) 것이 메모리나 프레임워크 최적화 관점에서 훨씬 깔끔하다.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 이런 의문을 가진 적이 없었는데... 읽다보니깐 정말 new 키워드로 객체를 생성할 때가 있지 않을까 의문이 생기네요?!
말씀하신대로 클래스 내부에만 사용한다면 직접 new로 생성하여 쓰는 게 더 좋은 거 같네요!!
좋은 정보 감사합니다 🙇

4. 매점 구매 시 환불 X
- 매점 구매 내역 테이블에서 상태 컬럼 생략 또는 무조건 ‘COMPLETED’

https://www.erdcloud.com/d/PhXPysc9AfrTJbSYq No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

와 저는 아직 고민밖에 안했는데 벌써 ERD까지 완성하셨네요! 👍
다음 주 과제 때 좀 헷갈리거나 잘 안되는 부분 있으면 참고하겠습니다! 😄

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정성스런 코드리뷰 감사합니다!!
짧지 않은 글이었을텐데 다 읽으시느라 수고 많으셨습니다!
저도 종훈님 글 보고 많이 배우고 얻어갑니다 🙇
벌써 코파일럿 쓰셨던데 그것도 멋지십니다!! 👍👍

Copy link

@Seungwon326 Seungwon326 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 완료했습니다!
고생 많으셨습니다!!

datasource:
url: jdbc:mysql://localhost:3306/${database}?allowPublicKeyRetrieval=true&useSSL=false&characterEncoding=UTF-8
username: root
password: ${password}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우혁님 코드 보고 저도 부랴부랴 password 가렸네요..
보안까지 꼼꼼하게.. 최고입니다..👍👍👍

format_sql: true
```

jpa 설정의 들여쓰기를 잘못하여 jpa가 datasource 안에 포함되게 하였다. 이 때문에 스프링이 jpa 설정을 인식하지 못하여 `ddl-auto` 설정이 동작하지 않았다. 들여쓰기를 수정하여 스프링 설정에서 jpa와 datasource가 서로 동등한 계층에 있도록 했다. 따라서 jpa 설정이 정상 작동하고, 테이블이 자동으로 생성되게 되었다.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.yml에서 들여쓰기는 정말 중요한거 같습니다..
저도 앞으로 더 신경써서 해야겠네요..

- **`update`**: 엔티티 변경분만 테이블에 반영 (가장 많이 쓰임)
- **`create`**: 서버 시작 시 기존 테이블을 삭제하고 새로 만듦(데이터가 날아가니 주의, 개발 시에만)
- **`none`**: 자동 생성 기능을 끔

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

문제가 생긴 부분과 관련한 자료까지 추가로 적어놓은 과정은 정말 좋은거 같습니다!
저도 이 설정 부분을 다시 한 번 복기 할 수 있었네요!
감사합니다☺️


// ... 비즈니스 로직 ...
}
```

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

직접 사용하신 예시 코드와 주석 설명을 통해 더 쉽게 이해 할 수 있었습니다!

- 상영관 ID, 좌석 행, 좌석 열 3개를 묶어서 유니크 키 제약조건 설정하기
4. 매점 구매 시 환불 X
- 매점 구매 내역 테이블에서 상태 컬럼 생략 또는 무조건 ‘COMPLETED’

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

주어진 조건을 더 자세하게 표현하고 효율적인 방식과 조건을 미리 생각해두신거 보고 자극받고 갑니다..
저도 열심히 해야겠습니다..

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제가 참고가 될 수 있어서 감사합니다!! 승원님도 워낙 잘 정리해주셔서 저도 참고하여 다시 한 번 복습할 수 있어서 좋았습니다...
코드 읽어주셔서 감사하고, 리뷰 성심성의껏 작성해주셔서 정말 감사합니다! 수고 많으셨어요~!! ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants