简体   繁体   English

如何使用 Spring 引导 2.x 验证 Java 应用程序是否使用 Hikari?

[英]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.在一个应用程序中,它连接到 Oracle 数据库并使用 Spring Boot 2.3.7 框架。
I need to definitively determine what connection pool technology it uses to connect to the Oracle database.我需要明确确定它用于连接 Oracle 数据库的连接池技术。 Because Hikari comes with Spring Boot 2.x and the application is auto-configured, there are no references to Hikari.因为 Hikari 附带 Spring Boot 2.x 并且应用程序是自动配置的,所以没有对 Hikari 的引用。 How can I determine if Hikari is being used?如何确定是否正在使用 Hikari?

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.您可以尝试在某处自动连接数据源,然后系统输出数据源的 class 名称,以查看正在使用的实现。

@Autowired
private DataSource dataSource;

then in a method that will run after Spring initializes然后在 Spring 初始化后运行的方法中

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:一种简单的方法,降低 Hikari 的日志记录级别,它在 DEBUG 级别非常详细,并为您提供有关配置、连接数及其状态的信息:

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

logging.level.com.zaxxer.hikari=DEBUG

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 Spring Data JPA 正确配置到 Spring Boot 2.X 应用程序的 application.properties 配置文件中? - How to correctly configure Spring Data JPA into the application.properties configuration file of a Spring Boot 2.X application? 当 Hikari 给出连接超时时如何重新启动 spring 启动应用程序? - How to restart spring boot application when Hikari give connection timeout? 如何在 spring boot 2.x 应用程序中设置 max-http-header-size - How to set max-http-header-size in spring boot 2.x application Spring 启动 2.x 批处理应用程序,如何访问千分尺缓存指标以进行日志记录? - Spring Boot 2.x Batch application, how to access Micrometer cache metrics for logging? 如何使用 spring boot 2.x 为 redis 集群设置密码 - How to set password for redis cluster with spring boot 2.x 如何迁移将AbstractMvcEndpoint扩展到Spring Boot 2.x的执行器? - How migrate an actuator that extends AbstractMvcEndpoint to Spring Boot 2.x? 如何在 Spring-boot 2.x 中一起发送 MultiPart 和 RequestBody - How to send MultiPart and RequestBody together In Spring-boot 2.x 如何在 Spring Boot 控制台应用程序中验证实体? - How to validate entity in Spring Boot console application? Spring 启动 - 如何在 rest 应用程序中验证 Multipartfile - Spring boot - How to validate Multipartfile in rest application Spring Boot 2.x连接工厂 - Spring Boot 2.x Connection Factory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM