score:0

Accepted answer

I found the problem was using Symbols for the binding identifier. I swapped them out for a solution using BindingIds and everything worked :

object BindingKeys {
  object Location extends BindingId
}

object ServerModule extends NewBindingModule (module => {
  import module._
  import BindingKeys._

  bind[String] idBy Location toSingle {
    Play.current.configuration.getString("file.location").getOrElse (
      throw new IllegalStateException("Cannot find file")
    )
  }

  bind[ThirdPartyLib] toProvider { implicit module =>
      val libLocation = inject [String] (Some(Location))
      ThirdPartyLib fromFile libLocation
  }

  bind[Controller] toProvider { implicit module => new Controller}})

Related Query

More Query from same tag