How to confgure the PGProperty TCP_KEEP_ALIVE that is available at HikariConfig

Viewed 764

How do I configure the property value that tcpkeepalive value is set to true?

I already tried

spring:
  datasource:
    connection-properties: tcpKeepAlive=true
    connectionproperties: tcpKeepAlive=true

However, without success.

HikariConfig does contain a Properties object, but how has the values be defined in the yml file that they are loaded there?

1 Answers

Assuming this property is a connection property of the driver, you need to configure the dataSourceProperties property on hikari. You can do this like:

spring:
  datasource:
    hikari:
      data-source-properties:
        tcpKeepAlive: true

Alternatively, you could include the properties in the spring.datasource.url property.

Related