These are chat archives for adamw/macwire

22nd
Mar 2016
Marius B. Kotsbak
@mkotsbak
Mar 22 2016 10:58
Hmm, yes it is trying to DI some type I am supposed to declare myself
Marius B. Kotsbak
@mkotsbak
Mar 22 2016 11:57
@adamw I am still unsure how I get a lazy val to be picket up by MacWire instead of it trying to contruct the class manually
Tried @Module
Adam Warski
@adamw
Mar 22 2016 12:02
@mkotsbak some simple snippet of what you are trying to do would be helpful :)
Marius B. Kotsbak
@mkotsbak
Mar 22 2016 12:17
Well, I see that it is needed to declare the dep using constructor parameters too, but what I have is a trait
I'm struggeling with this one:
DatabaseSetupAndTeardown.scala:30: Cannot find a public constructor nor a companion object for ...DatabaseProfile
at lazy val dbProfile = wire[DatabaseProfile]
Which is declared here:
@Module
trait TestModule extends BackendCoreModule {
    override lazy val dbProfile = H2TestProfile
}
But DatabaseSetupAndTeardown is a trait and can't be a class
Marius B. Kotsbak
@mkotsbak
Mar 22 2016 12:22
A workaround is to use a cake here instead. It compiles if I let DatabaseSetupAndTeardown inherit from TestModule, but then I don't use MacWire...
Adam Warski
@adamw
Mar 22 2016 13:09
I'm not sure what's the full example, but macwire only helps you to wire classes using constructor parameters
it's mostly a convenience tool so that you don't have to write the constructor call yourself
Marius B. Kotsbak
@mkotsbak
Mar 22 2016 15:05
Yes, but shouldnt the wire macro work too?