Skip to content
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

Feature/11: Spring boot와 MySQL 연동 #12

Merged
merged 3 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ out/
/.nb-gradle/

### VS Code ###
.vscode/
.vscode/

## ADD
mysql_data
Copy link
Collaborator

Choose a reason for hiding this comment

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

compose.yml은 다른 사람과 공유해서 개발 환경을 쉽게 셋업할 수 있게해야하지 않을까요? :-)

compose.yml
8 changes: 8 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ dependencies {

implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'

// mysql, jpa
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.mysql:mysql-connector-j'
developmentOnly 'org.springframework.boot:spring-boot-devtools'

testImplementation 'com.h2database:h2' // H2를 테스트용 DB로 사용 시
Copy link
Collaborator

Choose a reason for hiding this comment

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

이왕 mysql을 도입했으니, 테스트에서도 mysql을 사용하게 하면 좋을 것 같아요.


}

// Apply a specific Java toolchain to ease working on different environments.
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
spring:
profiles:
active: dev
datasource:
url: jdbc:mysql://localhost:3306/lingodb
username: root
password: pwd1234
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
hibernate:
ddl-auto: update
database-platform: org.hibernate.dialect.MySQLDialect
server:
port: 8081
logging:
Expand Down
9 changes: 9 additions & 0 deletions app/src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/lingodb
username: root
password: pwd1234
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
hibernate:
ddl-auto: create-drop
database-platform: org.hibernate.dialect.MySQLDialect
Loading