728x90
반응형
[Springboot] 31. DB 마이그레이션 (H2->MySQL)
1. application.yml 파일 세팅 변경
server:
port: 8080 #서버가 사용할 포트 번호 설정
servlet:
encoding:
charset: utf-8 #서블릿의 응답과 요청 인코딩을 UTF-8 로 설정
force: true # 요청과 응답에 대해 이 인코딩을 강제로 사용하도록 설정합니다.
spring:
mvc:
view:
prefix: /WEB-INF/view/ #JSP파일이 위치한 디렉토리 접두사를 설정합니다.
suffix: .jsp #뷰 이름에 자동으로 추가될 파일 확장자를 설정합니다.
datasource:
url: jdbc:mysql://localhost:3306/mybank?serverTimeZone=Asia/Seoul #데이터 베이스 연결을 위한 URL을 설정 합니다.
driver-class-name: com.mysql.cj.jdbc.Driver #드라이버 클래스를 설정 합니다.
username: root #사용자 ID를 지정
password: asd123 #DB 비밀번호 여기서는 빈 문자열로 설정
sql:
init:
schema-locations:
- classpath:db/table.sql
data-locations:
- classpath:db/data.sql
h2:
console:
enabled: true #H2 데이터 베이스 콘솔을 활성화 합니다.
output:
ansi:
enabled: always #콘솔 출력에 ANSI 색상 코드를 사용할 수 있도록 설정
#mybatis 설정
mybatis:
mapper-locations:
- classpath:mapper/**/*.xml #MyBatis 매퍼 파일 위치를 설정합니다. **은 모든 디렉토리, *.xml 은 모든 XML 파일을 의미합니다.
configuration:
map-underscore-to-camel-case: true #데이터베이스의 언더스코어 네이밍(column_name)을 카멜 케이스(columnName)로 자동 매핑합니다.
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #SQL 로깅 구현체를 설정합니다.
logging:
level:
org.apache.ibatis: DEBUG #MyBatis 로깅 레벨을 DEBUG로 설정하여 실행되는 SQL 쿼리와 내부 로깅 정보를 콘솔에 출력합니다.
728x90
반응형
'Springboot' 카테고리의 다른 글
[Springboot] 33. 파일 업로드(1단계-멀티 파트란?) (0) | 2024.08.13 |
---|---|
[Springboot] 32. 사용자 비밀번호 암호화 처리 (0) | 2024.08.13 |
[Springboot] 30. Intercepter 활용 (인증검사 공통 처리) (0) | 2024.08.13 |
[Springboot] 29. 계좌 상세 보기 기능(5단계-계좌 목록 페이징 처리) (0) | 2024.08.12 |
[Springboot] 28. 계좌 상세 보기 기능(5단계-정답 코드) (1) | 2024.08.12 |