简体   繁体   English

如何验证Slick是否正在使用application.conf中的参数?

[英]How to verify that Slick is using parameters from application.conf?

In application.conf, parameters are set: 在application.conf中,设置参数:

  url = "jdbc:mysql://.../table_name"
  user = ...
  password = ...
  driver = "com.mysql.jdbc.Driver"
  connectionPool = HikariCP
  queueSize = 25000

I am still receiving an error whenever the queue reaches 1000 items, meaning that the queueSize property is still the default value. 每当队列达到1000个项目时,我仍然会收到错误,这意味着queueSize属性仍然是默认值。

Task scala.slick.backend.DatabaseComponent$DatabaseDef$... 
rejected from java.util.concurrent.ThreadPoolExecutor...
[Running, pool size = 20, 
active threads = 20, 
queued tasks = 1000, 
completed tasks = 7507]

Not sure why it's not picking up your value, but you might want to try a different way of configuring.. you didn't say what version of Slick you are using. 不知道为什么它没有提升你的价值,但你可能想尝试不同的配置方式..你没有说你正在使用什么版本的Slick。 But please refer to the Slick 3.0.0 documentation . 但请参阅Slick 3.0.0文档 Try it using TypeSafe Config : 使用TypeSafe配置尝试:

In your application.conf : 在你的application.conf

database {
  dataSourceClass = "org.postgresql.ds.PGSimpleDataSource" // replace with mysql driver
  properties = {
    databaseName = "mydb"
    user = "myuser"
    password = "secret"
  }
  queueSize = 25000 // I've never changed that property, so not tested.
}

Then in scala: 然后在scala中:

val db = Database.forConfig("database")

Hope this works for you. 希望这对你有用。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM