I am using wire in my scala project. I have a usecase ---
class SchemaRegistry(registry: SchemaRegistryClient)
class SchemaRegistryClient(url: String) extends RestService(url) {}
trait EndpointModule {
// Schema Registry endpoint dependency
lazy val schemaRegistry: SchemaRegistry = wire[SchemaRegistry]
def schemaRegistryClient(url: String): SchemaRegistryClient = wire[SchemaRegistryClient]
}
object LightweightinstructionRunner extends EndpointModule with ConfigModule {
val client = schemaRegistryClient("")
}
This throws an error -
Cannot find a value of type: [etl.infrastructure.endpoints.SchemaRegistryClient]
It works if I create hardcoded object of SchemaRegistryClient inside the EndpointModule.
(val c = new SchemaRegsitryClient(""))
Can anyone help in explaining how to workaround this and what is happening here?
I cant seem to find a way to fulfill the dependency.
LightweightinstructionRunner is in a diff package while SchemaRegistry and SchemaRegistryClient are in the same package.