Skip to content

Not working with Guice 4.2.0 #12

@nsiniakevich

Description

@nsiniakevich

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions