-
Notifications
You must be signed in to change notification settings - Fork 78
[그리디] 이창희 Spring Core (배포) 7,8,9 단계 제출합니다 #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4d36d71
refactor: JWT 관련 로직 외부 모듈로 분리
chxghee 8a8ae72
refactor: DataLoader로 데이터 베이스 초기화 및 test prod 환경분리
chxghee 7d6bffe
docs: 리드미 작성
chxghee 06266fe
feat: 배포 스크립트 작성 deploy.sh
chxghee bcd4db2
refactor: prod, test 환경 분리
chxghee 7381a06
refactor: deploy.sh 프로세스 종료 로직 수정
chxghee 0d13b97
refactor: 실행 시 prod 환경 설정으로 실행 되도록 수정
chxghee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package jwt; | ||
|
||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties(JwtProperties.class) | ||
public class JwtConfig { | ||
|
||
@Bean | ||
public JwtTokenProvider jwtTokenProvider(JwtProperties jwtProperties) { | ||
return new JwtTokenProvider(jwtProperties); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...n/java/roomescape/auth/JwtProperties.java → src/main/java/jwt/JwtProperties.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
...ava/roomescape/auth/JwtTokenProvider.java → src/main/java/jwt/JwtTokenProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package roomescape; | ||
|
||
import org.springframework.boot.CommandLineRunner; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import roomescape.member.domain.Member; | ||
import roomescape.member.domain.MemberRepository; | ||
import roomescape.member.domain.Role; | ||
|
||
@Profile("prod") | ||
@Component | ||
public class DataLoader implements CommandLineRunner { | ||
|
||
private final MemberRepository memberRepository; | ||
|
||
public DataLoader(MemberRepository memberRepository) { | ||
this.memberRepository = memberRepository; | ||
} | ||
|
||
@Override | ||
@Transactional | ||
public void run(String... args) throws Exception { | ||
Member admin = new Member("어드민", "admin@email.com", "password", Role.ADMIN); | ||
Member user = new Member("브라운", "brown@email.com", "password", Role.USER); | ||
memberRepository.save(admin); | ||
memberRepository.save(user); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
server: | ||
port: 8080 | ||
|
||
spring: | ||
profiles: | ||
active: prod | ||
|
||
h2: | ||
console: | ||
enabled: true | ||
path: /h2-console | ||
|
||
datasource: | ||
url: jdbc:h2:mem:database | ||
|
||
jpa: | ||
show-sql: true | ||
properties: | ||
hibernate: | ||
format_sql: true | ||
ddl-auto: create | ||
|
||
roomescape: | ||
auth: | ||
jwt: | ||
secret: Yn2kjibddFAWtnPJ2AFlL8WXmohJMCvigQggaEypa5E= | ||
expiration: 1800000 |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ddl-auto 값을 운영 쪽은 create로, 테스트는 create-drop으로 잡으셨는데
create를 쓰더라도 애플리케이션 시작할 때 기존 테이블이 있으면 drop돼요!
의도하신 로직이실까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그렇게 큰 뜻은 없고,
테스트가 끝나면 테이블을 정리 하는 것이
흐름이 더 깔끔한것 같아서
create-drop
을 썼어요! 😅(인 메모리 DB를 쓰고 있으니까
create
을 써도 크게 차이가 없을 것 같긴 하네요)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ㅎㅎ이해했습니다!