https://shs2810.tistory.com/18
https://minkwon4.tistory.com/168
https://deepweller.tistory.com/6
application.properties : datasource 설정해주기
spring.datasource.driverClassName=org.mariadb.jdbc.Driver
spring.datasource.url=jdbc:mariadb://localhost:3306/테이블이름
spring.datasource.username=root
spring.datasource.password=패스워드
build.gralde : 아래 두개 의존성 추가하기
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jdbc
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc', version: '2.6.4'
// https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client
implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '3.0.3'
AppConfig.class : bean 추가해주기
@Configuration
@ComponentScan
public class AutoAppConfig {
private final DataSource dataSource;
public AutoAppConfig(DataSource dataSource){
this.dataSource = dataSource;
}
}