pre_02.16
* mysql연동관련 설정방법
- jpa를 사용하기위해 sql 연동하기 위한 yml파일
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/stackoverflow?serverTimezone=Asia/Seoul
username: root
password: 1234
jpa:
hibernate:
ddl-auto: create # (1) ??? ?? ??
show-sql: true # (2) SQL ?? ??
properties:
hibernate:
format_sql: true # (3) SQL pretty print
logging:
level:
org:
springframework:
orm:
jpa: DEBUG
의존성 세팅
implementation 'org.springframework.boot:spring-boot-starter-web'
runtimeOnly 'com.mysql:mysql-connector-j'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.mapstruct:mapstruct:1.5.3.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-mail'
mysql연결시 겪을 수 있는 실수와 에러
- 의존성에 mysql-connector-java가 아닌 j를 써야함(mysql버전이 낮을 때 발생하는 오류라고함)
-Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] 이라는 오류가 뜬 경우
yml파일 url주소 db이름에 해당하는 데이터베이스를 반드시 생성해야함
table 이름은 반드시 소문자 이어야함
깃 다른 브랜치에 push하는 방법
git push origin <branch 1>:<branch 2> 명령어를 이용하면 branch 1의 수정 사항을 branch 2에 푸시할 수 있다.
- git push origin branch1:branch2
깃 다른 브랜치 pull 하는 방법
git pull origin <branch name>
------------------------- 머지하기
1. merge 할 브랜치 이동
2. git merge 명령어 호출
3. git push 명령어 or vsCode 동기화 클릭
ex) 내 브랜치(myBranch) 소스 master에 merge할때
1. git checkout master
2. git merge myBranch
3. git push
-------
깃 임시저장 후 다른브랜치로 이동하기
git stash
git checkout 브랜치명 //
git stash pop // 다시 불러오기
gitignore 설정
gitignore파일 상단에 **/application.yml 추가
git rm –r --cached //추적되는 캐시삭제
git conflict(충돌) 해결
git merge --abort // 머지 취소
모든게 안되면 브랜치 이사가자