본문 바로가기

개발/Java

SpringBoot 시작시 com.mysql.jdbc.Driver. This is deprecated 경고메세지 발생

728x90
반응형

 

SpringBoot Application 실행시 'com.mysql.jdbc.Driver'. This is deprecated 경고 메세지가 발생

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

 

[SpringBoot] 'com.mysql.jdbc.Driver'. This is deprecated

2022-02-10 14:10:22.713  INFO 22372 --- [main] kr.co.app.Application           : Starting Application on DESKTOP with PID 22372 (C:\Users\developer\git\app\bin\main started by developer in C:\Users\developer\git\app)
2022-02-10 14:10:22.716 DEBUG 22372 --- [main] kr.co.app.Application           : Running with Spring Boot v2.1.7.RELEASE, Spring v5.1.9.RELEASE
2022-02-10 14:10:22.717  INFO 22372 --- [main] kr.co.app.Application           : No active profile set, falling back to default profiles: default
2022-02-10 14:10:25.056  INFO 22372 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 80 (http)
2022-02-10 14:10:25.091  INFO 22372 --- [main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-02-10 14:10:25.092  INFO 22372 --- [main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.22]
2022-02-10 14:10:25.357  INFO 22372 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-02-10 14:10:25.357  INFO 22372 --- [main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2374 ms
2022-02-10 14:10:25.505  WARN 22372 --- [main] com.zaxxer.hikari.HikariConfig           : {} - idleTimeout has been set but has no effect because the pool is operating as a fixed size pool.
2022-02-10 14:10:25.505  INFO 22372 --- [main] com.zaxxer.hikari.HikariDataSource       : SpringBootJPAHikariCP - Starting...
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2022-02-10 14:10:25.626  INFO 22372 --- [main] com.zaxxer.hikari.HikariDataSource       : SpringBootJPAHikariCP - Start completed.
2022-02-10 14:10:26.424  INFO 22372 --- [main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: static javax.servlet.ServletContext kr.co.app.config.FrontInitConfig_BOOT.servletContext
2022-02-10 14:10:26.745  INFO 22372 --- [main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static java.lang.String kr.co.app.common.controller.GlobalExceptionHandlerController.errorPath
2022-02-10 14:10:27.297  INFO 22372 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2022-02-10 14:10:27.996  INFO 22372 --- [main] s.a.ScheduledAnnotationBeanPostProcessor : No TaskScheduler/ScheduledExecutorService bean found for scheduled processing
2022-02-10 14:10:28.041  INFO 22372 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 80 (http) with context path ''
2022-02-10 14:10:28.046  INFO 22372 --- [main] kr.co.app.Application           : Started Application in 5.772 seconds (JVM running for 8.817)

 

MySQL Connector 사용시 DriverClassName을 지정해 주어야 하는데 MySQL 버전 8부터는 com.mysql.cj.jdbc.Driver 를 권장하는 것으로 파악된다.

추후 버전이 더 올라가면 com.mysql.jdbc.Driver 클래스는 deprecated 되었기 때문에 삭제될 가능성이 높다.

 

참고할 MySQL 공식사이트 - https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-usagenotes-connect-drivermanager.html

 

MySQL :: MySQL Connector/J 8.0 Developer Guide :: 7.1 Connecting to MySQL Using the JDBC DriverManager Interface

Example 7.1 Connector/J: Obtaining a connection from the DriverManager If you have not already done so, please review the portion of Section 7.1, “Connecting to MySQL Using the JDBC DriverManager Interface” above before working with the example belo

dev.mysql.com

com.mysql.cj.jdbc.Driver

 

728x90
반응형