没有HikariCP连接池的Spring Boot 2.1 App [英] Spring Boot 2.1 App without HikariCP Connection pooler

查看:140
本文介绍了没有HikariCP连接池的Spring Boot 2.1 App的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在没有任何连接池的情况下使用Spring Boot 2.1应用程序(在本例中为HikariCP),因为默认池是HikariCP!

I want to use my Spring Boot 2.1 App without any connection pooler (HikariCP in this case) since the default pooler is HikariCP !

我应该如何继续并实现这个吗?

How should I go ahead and implement this ?

用例是我想为我的所有应用程序
实例和其他应用程序使用一个通用的数据库缓冲池(pgBouncer)!
当每个Spring Boot应用程序使用其自己的隐式连接池(HikariCP)运行时,我无法实现。

The use case is I want to use a common db pooler (pgBouncer) for all my application instances and other applications ! I cannot achieve this when each Spring Boot app runs with its own implicit connection pooler(HikariCP).

我应该如何实现此用例?这是通用数据库连接池的更好解决方案吗?

How should I implement this use case ? Is this a better solution for common database connection pooling ?

推荐答案

您还可以通过提供简单的驱动程序数据源来停用它:

You can also deactivate it by providing simple driver datasource:

public DataSource datasource() throws SQLException {
    Driver driver = DriverManager.getDriver(url);
    SimpleDriverDataSource dataSource = new SimpleDriverDataSource(driver, url, username, password);
    return dataSource;
}

这篇关于没有HikariCP连接池的Spring Boot 2.1 App的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆