简体   繁体   中英

How to validate a Java application with Spring boot 2.x is using Hikari?

We are documenting the technology stack of our applications. In one application, it connects to an Oracle database and uses Spring Boot 2.3.7 framework.
I need to definitively determine what connection pool technology it uses to connect to the Oracle database. Because Hikari comes with Spring Boot 2.x and the application is auto-configured, there are no references to Hikari. How can I determine if Hikari is being used?

You could try to autowire the Datasource somewhere and then sys out the class name of the Datasource to see what implementation is being used.

@Autowired
private DataSource dataSource;

then in a method that will run after Spring initializes

System.out.println("DataSource : " + dataSource.getClass().toString());

A simple approach, reduce logging level of Hikari, it's quite verbose on DEBUG level and gives you information about configuration, number of connections and their statuses:

logging.level.com.zaxxer.hikari.HikariConfig=DEBUG 

logging.level.com.zaxxer.hikari=DEBUG

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM