2. 스프링 시큐리티 DB연결

스프링 부트에서는 하나의 RDB에 대해서 Configuration클래스를 작성하지 않고, 변수 설정을 통해 데이터베이스 연결을 진행한다. Config클래스에 자바 코드를 작성할 필요 없이 resources경로 아래에 존재하는 application.properties또는 application.yml파일에 데이터베이스 변수 설정을 통해 DB연결이 가능하다.

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://***<IP>***:***3306***/***<DBname>***?useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul&allowPublicKeyRetrieval=true
spring.datasource.username=***<id>***
spring.datasource.password=***<pw>***
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.mysql:mysql-connector-j'