Reputation: 195
I'm using MacWire DI framework and I'm geting this error.
Found multiple values of type [play.api.mvc.DefaultActionBuilder]: [List(defaultActionBuilder, Action)]
[error] override lazy val controllerComponents: DefaultControllerComponents = wire[DefaultControllerComponents]
My applicatopn Loader is this:
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]
I've been getting some other errors similar after small modifications of the code. How can I follow DI dependencies to track down these errors?
Upvotes: 1
Views: 1188
Reputation: 25314
Just encountered this myself, it appears to be due to this commit, which was included as a backport in Play 2.6.3:
...so code that compiles with Play 2.6.2 fails with Play 2.6.3.
Workarounds:
DefaultControllerComponents
- ie don't use MacWire for that particular constructorThat's not as pretty, but it works with Play 2.6.3:
val defaultControllerComponents = new DefaultControllerComponents(
defaultActionBuilder,
playBodyParsers,
messagesApi,
langs,
fileMimeTypes,
executionContext
)
Upvotes: 2