I have a Play 2.4 application with Scaldi bindings established the usual way with a
Module class registered in
application.conf. I need one of the bindings for some of my model classes like so:
import scaldi.Injectable._
import scaldi.Injector
case class File(key: String, fileName: String)
object File {
def apply(key: String)(implicit inj: Injector): File = File(key = key, fileName = inject[BoundClass].fileName(key))
}
First, is such a thing even possible?
Second, if so, how do I get access to the injector configured in application.conf? When I define a new module, I get a StackOverflowError, which makes sense to me since I define the same binding twice. Everything else I try leads to compile-time errors where Play complains there is no injector to be found.
Any insight is appreciated. Thanks.