application.properties h2 기본설정
#h2 console 활성화 및 경로 설정
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
#h2 db 설정
spring.datasource.url=jdbc:h2:mem:basic
spring.datasource.username=sa
spring.datasource.password=
#h2 db 함수설정
#spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
#hibernate 설정
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.hibernate.ddl-auto=create
#db log 설정
logging.level.org.hibernate.sql= debug
logging.level.org.apche.coyote.http11= debug
logging.level.org.hibernate.type= trace #SQL 실행 파라미터를 로그
application.yml h2 기본설정
spring:
# DB 연결
datasource:
# 설치된 H2 DB와 연결 URL
url: jdbc:h2:mem:basic #jdbc:mysql://127.0.0.1:3306/prac?
username: sa
password:
# 접속을 위한 드라이버
driver-class-name: org.h2.Driver #com.mysql.cj.jdbc.Driver
thymeleaf:
cache: false
jpa:
# 객체를 보고 자동으로 테이블 생성 여부. 생성 - create, 비생성 - none
# 테스트이기 때문에 create로 설정하며
# 실제로는 none 으로 합니다. create이면 기존의 테이블을 전부 밀어버립니다.
hibernate:
ddl-auto: create
properties:
hibernate:
# system.out 시점에서 출력(운영 환경에서는 아래 logging을 통해 조회한다)
# show-sql: true
format_sql: true
# 콘솔 확인 을 위한 always
output:
ansi:
enabled: always
jackson:
property-naming-strategy: SNAKE_CASE
#hibernate가 생성하는 jpa, sql문이 모두 콘솔에서 조회된다.
logging.level:
org.hibernate.SQL: debug
org.apche.coyote.http11: debug
org.hibernate.type: trace
외부라이브러리
1) 외부라이브러리 사용
참고 : https://github.com/gavlyukovskiy/spring-boot-data-source-decorator
2) 스프링 부트를 사용하면 이 라이브러리만 추가
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.5.6'
'웹 기술 쌈싸먹기 > Spring' 카테고리의 다른 글
[Spring] spring-boot-devtools 라이브러리 (0) | 2022.02.09 |
---|---|
[Spring] 라이브러리 살펴보기 (0) | 2022.02.09 |
[Spring] Spring MVC 공식 문서 (0) | 2022.01.28 |
[Spring / Servlet] Servlet??? Servlet 상품검색 API 예제 (0) | 2022.01.28 |
[AWS / Spring / MySql] EC2 구매, EC2 준비 및 배포, 포트포워딩 & nohup 적용 (0) | 2022.01.26 |