Play Framework:将配置从 2.3.8 迁移到 2.4.1

Play Framework: migrating configuration from 2.3.8 to 2.4.1

Play 2.4.1 的迁移指南说如果不使用进化,可以安全地省略 evolutionplugin = disabled...但是 dbplugin = disabledehcacheplugin = disabled 是什么?同样的原则适用吗?

他们老了,曾经出现过如下:

play.api.cache.EhCachePlugin#enabled:

  /**
   * Is this plugin enabled.
   *
   * {{{
   * ehcacheplugin.disabled=true
   * }}}
   */
  override lazy val enabled = {
    !app.configuration.getString("ehcacheplugin").filter(_ == "disabled").isDefined
  }

play.api.db.BoneCPPlugin#isDisabled:

  /**
   * plugin is disabled if either configuration is missing or the plugin is explicitly disabled
   */
  private lazy val isDisabled = {
    app.configuration.getString("dbplugin").filter(_ == "disabled").isDefined || dbConfig.subKeys.isEmpty
  }

这两个现在都走了。关于缓存,2.4documentation说:

It is possible to provide a custom implementation of the CacheApi that either replaces, or sits along side the default implementation.

To replace the default implementation, you’ll need to disable the default implementation by setting the following in application.conf:

play.modules.disabled += "play.api.cache.EhCacheModule"

关于数据库,只要不包括 jdbc 和任何其他数据库库依赖项就足够了。