Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sisu-users] Having trouble customizing one binding

I want to take detailed control of one binding.

In a module, I would write:

@Override
            protected void configure()
            {

bind(JsonFactory.class).annotatedWith(WsBusTicketCodecJsonFactory.class).to(SmileFactory.class);
            }

If I make a module by extending AbstractModule with this code, I have
a choice of two failure.

If I pass it to the injector ahead of WireModule, Guice complains that
I have a duplicate binding for this binding.

If I pass it to the WireModule as the first parameter, I stuck on a
different problem.

My module has several @Parameters-annotated methods. One is:

@Provides
            @Parameters
            WsBusConfig config() {
                return new WsBusConfig(configFilePathname);
            }

When my module is outside of WireModule, all is well. When it's inside, I get

WARN: Sisu - Ignoring incompatible @Parameters binding:
ProviderInstanceBinding[key=Key[type=com.basistech.wsbus.api.WsBusConfig,
annotation=@org.eclipse.sisu.Parameters],
source=com.basistech.wsbus.api.WsBusConfig
com.basistech.wsbus.launcher.BusBootstrap$1.config(),
scope=Scopes.NO_SCOPE, provider=@Provides
com.basistech.wsbus.launcher.BusBootstrap$1.config(BusBootstrap.java:91)]

followed by a cascade of problem when that value is not in fact injected.


Back to the top