PlayFramework 2.5:HikariCP忽略了application.conf中的一些(但不是全部)设置

时间:2017-02-23 10:29:51

标签: playframework hikaricp

我对PlayFramework 2.5中的HikariCP配置感到有点困惑。

我将其添加到我的application.conf文件中:

play.db {
  # The combination of these two settings results in "db.default" as the
  # default JDBC pool:
  config = "db"
  default = "default"  
  # Play uses HikariCP as the default connection pool.  You can override
  # settings by changing the prototype:
  prototype {
    hikaricp.maximumPoolSize = 30
    hikaricp.connectionTimeout = 5 seconds
    hikaticp.maxLifetime = 10 seconds
    hikaticp.idleTimeout = 5 seconds
  }
}

db.default.driver=org.postgresql.Driver
db.default.url=${?JDBC_DATABASE_URL}
db.default.username=${?DATABASE_USERNAME}
db.default.password=${?DATABASE_PASSWORD}

工作正常。我得到了与数据库的连接,可以提交查询等等。我的问题是,只使用了HikariCP设置的一部分。在应用程序开始时,我捕获使用过的HikariCP参数:

[ 2017-02-23 11:12:58,413 ] [info] application - Creating Pool for datasource 'default'
[ 2017-02-23 11:12:58,424 ] [debug] c.z.h.HikariConfig - HikariPool-1 - configuration:
[ 2017-02-23 11:12:58,430 ] [debug] c.z.h.HikariConfig - allowPoolSuspension.............false
[ 2017-02-23 11:12:58,431 ] [debug] c.z.h.HikariConfig - autoCommit......................true
[ 2017-02-23 11:12:58,431 ] [debug] c.z.h.HikariConfig - catalog.........................null
[ 2017-02-23 11:12:58,431 ] [debug] c.z.h.HikariConfig - connectionInitSql...............null
[ 2017-02-23 11:12:58,431 ] [debug] c.z.h.HikariConfig - connectionTestQuery.............null
[ 2017-02-23 11:12:58,431 ] [debug] c.z.h.HikariConfig - connectionTimeout...............5000
[ 2017-02-23 11:12:58,431 ] [debug] c.z.h.HikariConfig - dataSource......................null
[ 2017-02-23 11:12:58,431 ] [debug] c.z.h.HikariConfig - dataSourceClassName.............null
[ 2017-02-23 11:12:58,431 ] [debug] c.z.h.HikariConfig - dataSourceJNDI..................null
[ 2017-02-23 11:12:58,431 ] [debug] c.z.h.HikariConfig - dataSourceProperties............{password=<masked>}
[ 2017-02-23 11:12:58,431 ] [debug] c.z.h.HikariConfig - driverClassName................."org.postgresql.Driver"
[ 2017-02-23 11:12:58,431 ] [debug] c.z.h.HikariConfig - healthCheckProperties...........{}
[ 2017-02-23 11:12:58,431 ] [debug] c.z.h.HikariConfig - healthCheckRegistry.............null
[ 2017-02-23 11:12:58,431 ] [debug] c.z.h.HikariConfig - idleTimeout.....................600000
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - initializationFailFast..........true
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - isolateInternalQueries..........false
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - jdbc4ConnectionTest.............false
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - jdbcUrl........................."XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - leakDetectionThreshold..........0
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - maxLifetime.....................1800000
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - maximumPoolSize.................30
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - metricRegistry..................null
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - metricsTrackerFactory...........null
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - minimumIdle.....................30
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - password........................<masked>
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - poolName........................"HikariPool-1"
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - readOnly........................false
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - registerMbeans..................false
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - scheduledExecutorService........null
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - threadFactory...................null
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - transactionIsolation............null
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - username........................"XXXXXXXXXXXXXXXX"
[ 2017-02-23 11:12:58,432 ] [debug] c.z.h.HikariConfig - validationTimeout...............5000

maximumPoolSizeconnectionTimeout的值在application.conf中设置。但maxLifetimeidleTimeout的值会被忽略并设置为其他值。

application.conf的语法在某些方面是错误的,我没有看到错误吗?

0 个答案:

没有答案