macwire
macwire copied to clipboard
Lightweight and Nonintrusive Scala Dependency Injection Library
If we want to use an alternative constructor for a regular class, we can use the `wireWith` function to select the factory that we want. It would be nice to...
If class A depends on B, which depends on and I have a C, can I instantiate an A without also wiring up a B? In other words, would it...
If I have a trait with an inner trait like this: ```scala trait FooComponents { lazy val fooService: FooService = wire[FooService] trait FooRequestScopedComponents { def request: RequestHeader def fooController: FooController...
First, a REPL transcript: ``` Welcome to Scala 2.12.1 (OpenJDK 64-Bit Server VM, Java 1.8.0_121). Type in expressions for evaluation. Or try :help. scala> import com.softwaremill.macwire.wire import com.softwaremill.macwire.wire scala> class...
I'm not sure if this fits into the project's scope and if it's generally possible: Instead of wiring classes, I like to wire/bind closures. This offers to provide the interface...
I am using an external class Foo: ``` Java public Foo() { } public Foo(Bar bar) { this.bar = bar; } ``` and trying to wire it in my Scala...
**MacWire Version:** 2.11-2.2.0 **Play! Version:** 2.11-2.3.10 The incremental compilation fails when adding/removing a class file with: > java.lang.RuntimeException: Cannot find implementations of class class controllers.FooBarGong! > at com.softwaremill.macwire.InstanceLookup$class.lookupSingleOrThrow(InstanceLookup.scala:13) ~[util_2.11-2.2.0.jar:2.2.0] >...
If you're wondering how to deal with multiple constructors with macwire here is a pattern. So you have this `X` class that provides default implementations for some of its parameters:...
Currently we have this problem: ``` scala case class A() case class B(a: A) object Test { lazy val a: A = wire[A] def buildSomeA(i: Int): A = A() lazy...
At the moment only public members are eligible for wiring. We should also accept: - protected members of parent classes/traits - package private/protected members if we're in the same package