Toothpick inject в конструктор Qualifier параметр
Я изучаю Toothpick, и столкнулся с проблемой, что не получается внедрить строку в конструктор. Получаю следующую ошибку: toothpick.locators.NoFactoryFoundException: No factory could be found for class java.lang.String. Check that the class has either a @Inject annotated constructor or contains @Inject annotated members. Подскажите,что я делаю не так?
@Qualifier annotation class ServerEndpoint
class NetworkModule : Module() {
init {
bind(String::class.java).withName(ServerEndpoint::class.java) to BuildConfig.BASE_URL
bind(Gson::class.java).toInstance(GsonBuilder().create())
bind(OkHttpClient::class.java).toProvider(OkHttpProvider::class.java)
bind(Retrofit::class.java).toProvider(RetrofitProvider::class.java)
bind(ApiService::class.java).toProvider(ApiServiceProvider::class.java)
}
}
@InjectConstructor
class RetrofitProvider(
@field:ServerEndpoint private val baseUrl: String,
private val okHttpClient: OkHttpClient,
private val gson: Gson
) : Provider<Retrofit> {
override fun get(): Retrofit = Retrofit.Builder()
.baseUrl(baseUrl)
.client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create(gson))
.addCallAdapterFactory(RxJava2CallAdapterFactory.createWithScheduler(Schedulers.io()))
.build()
}