I tried to reproduce you error with the test below. So far I cannot
reproduce it.
can you try to nail down the problem by commenting out as many lines
in your ServerModule as possible until you have the minimal
configuration which produces the binding error.
------------------
import org.jukito.JukitoModule;
import org.junit.Test;
import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Provides;
import com.google.inject.Singleton;
public class BindingToProviderTest {
public static class MyModuel extends JukitoModule {
@Override
protected void configureTest() {
install(new ServerModule());
}
}
@Test
public void foo() {
System.out.println("done");
}
}
class ServerModule extends AbstractModule {
@Override
protected void configure() {
}
@Provides
@Singleton
@Inject
public final SasDataProvider getSasDataProvider(final ServerConfig
config,
final Provider<DataProviderFileImpl> sasFile, final
Provider<SasDataProviderHttpImpl> sasHttp) {
if (config.getSasUrl().equalsIgnoreCase("DEMO")) {
return sasFile.get();
}
return sasHttp.get();
}
}
interface SasDataProvider {
}
class ServerConfig {
public String getSasUrl() {
return "";
}
}
class DataProviderFileImpl implements SasDataProvider {
}
class SasDataProviderHttpImpl implements SasDataProvider {
}