[Scala 2.6.0-M3] controllers.AssetsComponents with macwire

136 views
Skip to first unread message

Evan Bennett

unread,
Mar 29, 2017, 9:58:12 PM3/29/17
to Play Framework
While migrating to Play 2.6.0-M3 I am updating to the new AssetsFinder API as suggested in the Migration Guide.

I have updated my component so it is declared:
   abstract class Base(context: play.api.ApplicationLoader.Context) extends play.api.BuiltInComponentsFromContext(context) with play.filters.hosts.AllowedHostsComponents with controllers.AssetsComponents with ...
the `...` is some custom component traits.

I am using: "com.softwaremill.macwire" %% "macros" % "2.3.0" % "provided"

I have a controller, that has an argument `assetsFinder: controllers.AssetsFinder` which it passes to twirl views (as suggested in the Migration Guide).

When I compile the project, I get the following error:
C:\dev\github\base-play\src\main\scala\components\Base.scala:54: Found multiple values of type [controllers.AssetsFinder]: [List(assetFinder, assetsMetadata)]
        lazy val baseApplicationController = wire[controllers.base.Application]

Both `assetFinder` and `assetsMetadata` are defined on `controllers.AssetsComponents`, with `assetFinder` (which I think should be `assetsFinder` with an 's') declared:

I think that the `assetFinder` declaration should be removed, but I am not sure how other DI implementations would handle this.

Greg Methvin

unread,
Mar 29, 2017, 10:23:51 PM3/29/17
to play-framework
Thanks for mentioning this. AssetsMetadata is effectively internal API (it has no public methods besides those in AssetsFinder), so we could make it private. But maybe we should also refactor to use composition instead of inheritance, so there is no conflict between the two.

--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/2f156406-594c-49bf-affd-eb528ea76c07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Greg Methvin
Tech Lead - Play Framework

Reply all
Reply to author
Forward
0 new messages