Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with Guice 4.2.0 #12

Open
nsiniakevich opened this issue Mar 15, 2018 · 0 comments
Open

Not working with Guice 4.2.0 #12

nsiniakevich opened this issue Mar 15, 2018 · 0 comments

Comments

@nsiniakevich
Copy link

nsiniakevich commented Mar 15, 2018

Simple groovy script to reproduce the issue

@Grapes([
        @Grab(group = 'com.google.inject', module = 'guice', version = '4.2.0'),
        @Grab(group = 'org.99soft.guice', module = 'rocoto', version = '6.3')
])
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.name.Names;
import org.nnsoft.guice.rocoto.Rocoto;

Injector injector = Guice.createInjector(Rocoto.expandVariables(new AbstractModule() {
    @Override
    protected void configure() {
        Properties properties = new Properties();
        properties.put("JDBC.host", "localhost");
        properties.put("JDBC.port", "3306");
        properties.put("JDBC.schema", "test");

        Names.bindProperties(binder(), properties);
    }
}))

I used code from getting started example http://99soft.github.io/rocoto/getting-started.html

The result is:

java.lang.UnsupportedOperationException: getProvider() not supported for module bindings
	at com.google.inject.internal.BindingImpl.getProvider(BindingImpl.java:73)
	at org.nnsoft.guice.rocoto.Rocoto$2.visit(Rocoto.java:98)
	at org.nnsoft.guice.rocoto.Rocoto$2.visit(Rocoto.java:75)
	at com.google.inject.internal.BindingImpl.acceptVisitor(BindingImpl.java:99)
	at org.nnsoft.guice.rocoto.Rocoto.configure(Rocoto.java:74)
	at com.google.inject.AbstractModule.configure(AbstractModule.java:61)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:344)
	at com.google.inject.spi.Elements.getElements(Elements.java:103)
	at com.google.inject.util.Modules$OverrideModule.configure(Modules.java:195)
	at com.google.inject.AbstractModule.configure(AbstractModule.java:61)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:344)
	at com.google.inject.spi.Elements.getElements(Elements.java:103)
	at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:137)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
	... 4 more

BTW, the same code works with guice 4.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant