Stack Exchange
Guice @Inject class from jar - No implementation was bound
I have Maven project which uses another project as jar library. I have @Inject'ed UserService interface from jar and I get:
com.google.inject.ConfigurationException: Guice configuration errors:
1) No implementation for UserService was bound.
I have tried to bind UserService interface to the concrete class but later I get "No implementation for ... was bound" exceptions for classes injected into UserService. How to solve this problem?

public class UserServiceImpl implements UserService
@Override
protected void configure() {
    Properties configProperties = loadPropertiesFile("device.properties");
    bind(Properties.class).annotatedWith(AppProperties.class).toInstance(configProperties);

    Names.bindProperties(binder(), configProperties);
    Names.bindProperties(binder(), loadProperties("/" + GenericBootstrapConstants.BOOTSTRAP_PROPERTIES_FILE));

    bind(UserService.class).to(UserServiceImpl.class);
}


Can you show the code of the configure() method, and the class header of the class that implements UserService?

You should configure every injected service which hasn't a default implementation.

Should I configure within main project or in external project? Both uses Maven, Guice, JAX-RS.

When I run external jar project separately, it works well without configuration. There is no interface which is implemented in more than 1 class.

Hm ... this should work. Could you paste more code and/or stacktrace, please?

I have bind() and addMapperClasses() for every injected service. Thanks Jérémie B
