Skip to content

[그리디] 이채현 SpringCore 7~9단계 제출합니다. - #272

Open
chaehyunL wants to merge 117 commits into
next-step:chaehyunlfrom
chaehyunL:JPA4
Open

[그리디] 이채현 SpringCore 7~9단계 제출합니다.#272
chaehyunL wants to merge 117 commits into
next-step:chaehyunlfrom
chaehyunL:JPA4

Conversation

@chaehyunL

@chaehyunL chaehyunL commented Jul 25, 2026

Copy link
Copy Markdown

🙋‍♂️인사🙋‍♂️

안녕하세요. 세종대학교 그리디 백엔드 4기 이채현입니다.


Spring JPA Spring Core 배포

🚀 7단계 - @configuration

JWT 관련 로직을 roomescape와 같은 계층의 auth 패키지의 클래스로 분리하고,
불필요한 DB 접근을 최소화하기.

🚀 8단계 - Profile과 Resource

schema.sql 대신 데이터베이스를 초기화 해주기 위해 실행하는 클래스를 생성.
스프링이 실행될 때 동작해야 함.
token 생성에 필요한 비밀키값을 외부 파일로 분리하기.

🚀 9단계 - 배포 스크립트

ec2나 서버에서 배포를 할 수 있게 배포 스크립트를 작성하기.


고민한 내용 🤔

  1. JwtProvider를 auth package를 생성해서,JwtConfig와 JwtUtils로 분리해줬는데, 이렇게 구성하면 장점이 궁금합니다.

배포스크립트와 초기 설정의 시나리오가 어떻게 사용되는지 잘 모르겠습니다...

@chaehyunL chaehyunL changed the title [그리디] Spring Core 배포 [그리디] 이채현 SpringCore 7~9단계 제출합니다. Jul 27, 2026

@supernovaMK supernovaMK left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

JwtProvider를 auth package를 생성해서,JwtConfig와 JwtUtils로 분리해줬는데, 이렇게 구성하면 장점이 궁금합니다.

현재 config파일을 통해서 빈으로 등록한 후 객체를 등록해주고 있네요. 이랬을때 장점은 무엇일까요? 설정 파일에서 설정들을 한번에 모아서 할 수 있을때 장점을 생각해보면 좋을 것 같아요. 만약 jwt에 대한 설정을 바꿔야할때는 어떨까요?

배포스크립트와 초기 설정의 시나리오가 어떻게 사용되는지 잘 모르겠습니다...

배포스크립트는 왜 필요할까요? 있으면 장점이 무엇일까요? 배포 스크립트는 말 그대로 배포하기 위한 명령어가 모여있는 스크립트입니다. 해당 스크립트 실행으로 빠르게 배포를 도와주는 파일입니다.
그렇다면 배포 스크립트를 이해하기 위해서는 배포란 무엇이고 배포를 하기 위해서는 어떤게 필요한지 공부하면 좋을 것 같아요! 채현님이 이해하신 배포란 어떤 것인가요?

Comment thread script/deploy.sh
Comment on lines +1 to +14
git pull code JPA4
./gradlew clean build
PID=$(cat application.pid 2>/dev/null)

if [ -n "$PID" ]; then
kill -15 "$PID"
sleep 5
fi

JAR=$(find build/libs -name "*.jar" | head -n 1)

nohup java -jar "$JAR" > application.log 2>&1 &

echo $! > application.pid

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 과정이 어떤 과정인지 옆에 주석으로 달아주셔도 좋을 것 같아요!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

이 부분을 ai 도움을 많이 받은 것 같습니다.

아직 script 파일이 어떻게 작성되어야 하고 어떻게 쓰여야 하는지 잘 감이 안 잡힙니다.

제가 봤을때는 docs README 파일과 차이를 잘 모르겠다는 느낌이 드는 것 같아요

주석은 달았습니다 ~~!!.

Comment on lines +13 to +17
@Bean
public JwtUtils jwtUtils(@Value("${roomescape.auth.jwt.secret}")String secret){
Key key = Keys.hmacShaKeyFor(secret.getBytes(StandardCharsets.UTF_8));
return new JwtUtils(key);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

config에서 하고 있는 것은 무엇일까요? 그럼 그것을 할때 이점은 없을까요?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

config의 역할

소프트웨어 설정 저장/ 시스템 및 네트워크 구성 관리/ 보안 및 접근 제어 입니다.

비밀키의 변경이 용이하게 config를 통해 가능하게 됩니다

Comment on lines +16 to +17
@Component
public class TestDataLoader implements CommandLineRunner {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

현재 이 TestDataLoader는 어떤 역할을 하고 있나요?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

테스트용 데이터를 대신 생성해주고 있습니다

Comment thread src/main/README.md
Comment on lines +15 to 16
### 🚀 8단계 - Profile과 Resource

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Profile과 Resource는 각각 어떤 의미인가요?

profile은 어떤거고 언제 사용하나요~?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Profile의 경우, 실행 환경에 따라 다른 설정을 사용하기 위한 기능이고,
Resource는, 프로젝트 안에 있는 파일이나 외부 파일을 의미합니다.

Profile은 어디에서 사용하냐면요, 애플리케이션을 실행하는 환경을 구분해야할때 사용합니다.

@chaehyunL

Copy link
Copy Markdown
Author

config가 존재하면

설정이 한 곳에 모여서, jwt와 관련된 설정은 모두 config에 있음.

구현 클래스와 설정을 분리하여, 관리 보수가 적절한 것 같습니다.

배포란 개발한 프로그램을 서버 환경에 반영하는 것입니다.
배포하기 위해서는 배포 명령어를 공부해야할 것 같습니다.

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.

2 participants