【问题标题】:How do you set certain spring.datasource properties in broadleaf你如何在阔叶树中设置某些 spring.datasource 属性
【发布时间】:2017-11-04 04:43:12
【问题描述】:

我们使用的是带有spring-boot(使用tomcat连接池)和mysql的5.2版本的broadleaf。

如果有一段时间没有活动,例如在夜间,它会失去连接并且无法重新建立连接。我一直在阅读它并瞄准使用 spring.datasource.tomcat.test-on-borrow 和 spring.datasource.validation-query 属性,但它们似乎并没有坚持。

我们在 common-shared.properties 中设置了其他数据库属性,例如:

database.user=...
database.password=...
database.driver=com.mysql.jdbc.Driver
database.url=jdbc:mysql://localhost:3306/broadleaf?useUnicode=true&characterEncoding=utf8

用阔叶树处理这个问题的正确方法是什么?

【问题讨论】:

    标签: broadleaf-commerce


    【解决方案1】:

    对此感到抱歉; Broadleaf 数据库属性与那些特定属性无关,而是与您在database.user 中拥有的那些属性无关...等来自the DatabaseStarter project。设置spring.datasource.tomcat.test-on-borrowspring.datasource.validation-query

    但是,看起来您遇到的问题与我在 DatabaseStarter 中解决的 in this PR (例如您正在使用的 MySQL)和 HSQLDatabaseStarter 中的 this PR 解决的问题完全相同(这是您获得的默认值)。因此,只要您使用的是 Broadleaf 的最新 GA(特别是至少 5.2.1-GA),您就可以开始使用了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-09-23
      相关资源
      最近更新 更多