본문 바로가기

Web/spring

[Spring setting] application.properties 자주 쓰는 설정

728x90

https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html

 

#h2 DB 

spring.datasource.url=
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=


# h2 console
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console

 

# log level

logging.level.root=DEBUG
logging.level.sql=DEBUG

 

# gmail SMTP 

 

# email SMTP server
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username= #유저이메일
spring.mail.password= #비밀번호 < 구글설정에서 발급받은 비밀번호를 넣어야함
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.timeout=5000
spring.mail.properties.mail.smtp.starttls.enable=true

 

 

#mysql

# MySQL8 세팅
spring.datasource.url=jdbc:mysql://localhost:3306/db이름?useSSL=false&characterEncoding=UTF-8&serverTimezone=UTC
spring.datasource.username=#username
spring.datasource.password=#password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

 

 

 

#hibernate

# hibernate
spring.jpa.database=mysql
spring.jpa.hibernate.ddl-auto=create 
spring.jpa.hibernate.naming.strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.generate-ddl=false
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true

 

ddl-auto 종류

none : not work

create :  실행할 때 drop, create

create-drop :  종료할 때 drop

update : 변경부분만 반영

validate : mapping 확인만

728x90