Hi there,
I would like to fix https://github.com/scaldi/scaldi-jsr330/issues/1
Before I'll push PR, I would like to write a test, which will reproduce the error. My current problem is in test setup: how to create scaldi module, which fills `bindings` variable at `OnDemandAnnotationInjector`?
Basically, how to pass at line https://github.com/scaldi/scaldi-jsr330/blob/master/src/main/scala/scaldi/jsr330/OnDemandAnnotationInjector.scala#L17 to `orElse` block?
I have tried example below, but it leads to fully initializes `bindings` during `getBindingInternal` call.
Could you please give me a clue how-to create module in scalatest, with one instance of `OnDemandAnnotationInjector` to pass to the line https://github.com/scaldi/scaldi-jsr330/blob/master/src/main/scala/scaldi/jsr330/OnDemandAnnotationInjector.scala#L19 ?
My current ecample:
class ScaldiDep1(d1: Provider[Dependency1], name: String = "sd1") {
@javax.inject.Inject()
def this(dependency1: Provider[Dependency1]) = this(dependency1, "sdd1")
lazy val di1Accessor = d1.get
}
class ScaldiDep2(d2: Provider[Dependency2], name: String = "sd2") {
@javax.inject.Inject()
def this(dependency2: Provider[Dependency2]) = this(dependency2, "sdd2")
lazy val di2Accessor = d2.get
}
case class Dependency1(name: String)
case class Dependency2(name: String)
class Routes(
dependency1: Provider[ScaldiDep1],
dependency2: Provider[ScaldiDep2],
val name: String
) {
@javax.inject.Inject()
def this(
dependency1: javax.inject.Provider[ScaldiDep1],
dependency2: javax.inject.Provider[ScaldiDep2]
) = this(dependency1, dependency2, "test")
lazy val accessorDep1 = dependency1.get().di1Accessor
lazy val accessorDep2 = dependency2.get().di2Accessor
}
val i = 1
val m1 = new Module {
binding to injected[Dependency1]('name -> s"name 1$i")
binding to injected[Dependency2]('name -> s"name 2$i")
}
val standard = Seq(m1, new OnDemandAnnotationInjector)
implicit val injector = new MutableInjectorAggregation(standard.toList)
val test = inject[Routes]
Cheers,
Boris