라이브러리는 도서관 아닌가요

Loading class 'com.mysql.jdbc.Driver'. This is deprecated. The new driver class is 'com.mysql.cj.jdbc.Driver'. 본문

Spring/Spring 참고 내용

Loading class 'com.mysql.jdbc.Driver'. This is deprecated. The new driver class is 'com.mysql.cj.jdbc.Driver'.

veryhi 2021. 10. 25. 18:23

 

Spring Boot에서 종종 버전 차이로 만날 수 있는 에러이다.

 

 

 

있을 수 있는 경우 1

logback-spring을 사용하기 위해 설정을 하고 실행하면, 

 

이는 Mysql의 버전이 향상되어 해당 driver의 명칭이 바뀌었기 때문이다.

 

이 때 log4jdbc가 자동으로 선택한 드라이버를 변경하여 지정하기 위해 코드를 추가해주어야 한다.

 

아래가 기존의 코드이다.

# log4jdbc.log4j2.properties 파일 내용
log4jdbc.spylogdelegator.name = net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator log4jdbc.dump.sql.maxlinelength = 0

 

해당 코드 아래에 다음의 추가한다.

log4jdbc.drivers=com.mysql.cj.jdbc.Driver
log4jdbc.auto.load.popular.drivers=false

 

혹시나 재시작시켜도 동작하지 않는다면, IDE를 종료하고 다시 실행!

Comments