registerForClosing
would add the instance to a list and return it unmodified
Config
availableI'm a little surprised by the following behavior
given a type PlatformsPage with dependencies
class PlatformsPage(platformStore:PlatformStore,platformBackend:(BackendScope[Props,State] => Backend))
I'm trying to create a factory method (platformsBackend) as a def.
trait PlatformsModule {
lazy val platformsPage = wire[PlatformsPage]
lazy val platformsStore = wire[PlatformStore]
def platformsBackend(scope:BackendScope[Props,State]):Backend = new Backend(scope)
}
This results in an error:
Cannot find a value of type: [japgolly.scalajs.react.BackendScope[spatutorial.client.modules.platform.Props,spatutorial.client.modules.platform.State] => spatutorial.client.modules.platform.Backend]
however these versions work
lazy val platformsBackend:BackendScope[Props,State] => Backend = new Backend(_)
type BackendFactory = BackendScope[Props,State] => Backend
lazy val platformsBackend:BackendFactory = new Backend(_)
can function defs not be used to create factory dependencies?
[error] /home/guersam/workspace/github/macwire/examples/play24/app/com/softwaremill/play24/AppApplicationLoader.scala:36: Found multiple values of type [slick.driver.H2Driver.api.Database]: [List(db, db)]
[error] val seed = wire[Seed]
[error] ^
[error] /home/guersam/workspace/github/macwire/examples/play24/app/com/softwaremill/play24/AppApplicationLoader.scala:31: Cannot find a value of type: [String]
[error] lazy val router: Router = wire[Routes] withPrefix "/"
[error] ^
[error] two errors found
[error] (compile:compileIncremental) Compilation failed
@javax.inject.Inject()
)class AppApplicationLoader extends ApplicationLoader {
def load(context: Context) = {
Logger.configure(context.environment)
(new BuiltInComponentsFromContext(context) with AppComponents).application
}
}
Actually it is working now :)
import play.api.Play.current
import play.api.libs.concurrent.Akka
trait ActorsModule {
lazy val actorSystem = Akka.system
}
this module is fine. The problem was here
object Global extends GlobalSettings with Macwire {
val wired = wiredInModule(Application)
override def getControllerInstanceA = wired.lookupSingleOrThrow(controllerClass)
}
I made wired
lazy and all goes fine :)
import play.api.Play.current
import play.api.libs.concurrent.Akka
trait ActorsModule {
lazy val actorSystem = Akka.system
lazy val dbPoolActor = actorSystem.actorOf(Props(wire[DBPoolActor])).taggedWith[DBPoolActor]
}
class PostgreDatabase(dBPoolActor: ActorRef @@ DBPoolActor) extends Database { ...
}