我使用的是MacWire DI框架,我会得到这个错误。
Found multiple values of type [play.api.mvc.DefaultActionBuilder]: [List(defaultActionBuilder, Action)]
[error] override lazy val controllerComponents: DefaultControllerComponents = wire[DefaultControllerComponents]我的应用程序是:
class AppApplicationLoader extends ApplicationLoader {
def load(context: Context) = {
LoggerConfigurator(context.environment.classLoader).foreach { cfg =>
cfg.configure(context.environment)
}
new AppComponents(context).application
}
}
class AppComponents(context: Context) extends
BuiltInComponentsFromContext(context) with AhcWSComponents
with AssetsComponents with HttpFiltersComponents
with EvolutionsComponents with DBComponents with HikariCPComponents with EhCacheComponents {
override lazy val controllerComponents: DefaultControllerComponents = wire[DefaultControllerComponents]在对代码做了一些小修改之后,我也得到了一些类似的错误。如何跟踪DI依赖项来跟踪这些错误?
发布于 2017-09-12 16:42:57
我自己也遇到了这种情况,这似乎是由于这个提交,它是作为backport包含在Play 2.6.3中的:
使用Play 2.6.2编译的...so代码在Play 2.6.3中失败。
解决办法:
DefaultControllerComponents -(不对特定构造函数使用MacWire )这并不是很漂亮,但它适用于2.6.3的游戏:
val defaultControllerComponents = new DefaultControllerComponents(
defaultActionBuilder,
playBodyParsers,
messagesApi,
langs,
fileMimeTypes,
executionContext
)https://stackoverflow.com/questions/46092028
复制相似问题