Scaldi dependency injection with Constructor

166 views Asked by At

I have three classes class A, class B and class C. I want to inject Class A and Class B as a dependency through constructor to Class C. I am using ScalDI dependency injection framework. Can someone tell me how I can do it?

class A {
...}
class B {
..}
class C(a:A , b:B) = {
...}
1

There are 1 answers

0
L.Lampart On

There is short explanation on scaldi website: constructor injection

You have to use injected macro, or inject them in the following fashion:

bind [C] to new C(inject [A], inject [B])

Of Course binding to A and B have to be defined as well.