Could I ask another question <@U0BRK9HC5>? Given: ``` @Provides @Singleton fun provideOdooClient(xm...
d
Could I ask another question @gildor? Given:
Copy code
@Provides @Singleton fun provideOdooClient(xmlRpcCoroutineClient: XmlRpcCoroutineClient): OdooClient =
			OdooClientImpl(
					xmlRpcCoroutineClient,
					System.getenv("ODOO_HOST"),
					System.getenv("ODOO_PORT")?.toInt(),
					System.getenv("ODOO_DB")
			)

	@Provides @Named("isOdooClientReady") fun provideOdooClientStatus(odooClient: OdooClient): Deferred<Boolean> =
			odooClient.login(
					System.getenv("ODOO_USER"),
					System.getenv("ODOO_PASS")
			)
And (in main verticle):
@Inject @Named("isOdooClientReady") lateinit var isOdooClientReady: Deferred<Boolean>
Is there any reason I should be getting
Copy code
ModelComponent.java:10: error: kotlinx.coroutines.experimental.Deferred<java.lang.Boolean> cannot be provided without an @Provides- or @Produces-annotated method.
    public abstract void inject(@org.jetbrains.annotations.NotNull()
?
g
Hmm, probably
@get:Named
Because I don't see qualifier in error message
d
Tried:
@get:Inject @get:Named("isOdooClientReady") lateinit var isOdooClientReady: Deferred<Boolean>
and
@Inject @get:Named("isOdooClientReady") lateinit var isOdooClientReady: Deferred<Boolean>
But still getting the error... any better way of doing or debugging this @gildor?
Got that too, it was:
@field:[Inject Named("isOdooClientReady")] lateinit var isOdooClientReady: Deferred<Boolean>
Thanks to https://medium.com/@WindRider/correct-usage-of-dagger-2-named-annotation-in-kotlin-8ab17ced6928 Starting to get there... 😉
👍 1
g
Just use mostly constructor injection, so don’t have a lot of cases with field injection, especially with qualifieers