如何配置tcpkeepalive值设置为true的属性值?
我已经尝试过了
spring:
datasource:
connection-properties: tcpKeepAlive=true
connectionproperties: tcpKeepAlive=true
但是,没有成功。
HikariConfig 确实包含一个 Properties 对象,但是如何在加载它们的 yml 文件中定义这些值?
最佳答案
假设此属性是驱动程序的连接属性,您需要在 hikari
上配置 dataSourceProperties
属性。你可以这样做:
spring:
datasource:
hikari:
data-source-properties:
tcpKeepAlive: true
或者,您可以将这些属性包含在 spring.datasource.url
属性中。
关于java - 如何配置 HikariConfig 中提供的 TCP_KEEPALIVE 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65735288/