final Properties properties = new Properties();
properties.setProperty("a", "1");
properties.setProperty("b", "2");
properties.setProperty("c", "3");
Injector injector = lifecycleInjectorBuilder
.withBootstrapModule
(
new BootstrapModule()
{
@Override
public void configure(BootstrapBinder binder)
{
binder.bindConfigurationProvider().toInstance(new PropertiesConfigurationProvider(properties));
}
}
)
.createInjector();
ObjectWithConfig obj = injector.getInstance(ObjectWithConfig.class);
Assert.assertEquals(obj.a, 1);
Assert.assertEquals(obj.b, 2);
Assert.assertEquals(obj.c, 3);
}