Closed hiddenbyte closed 8 years ago
ping
I believe I originally had the GuiceVertxBinder
in the GuiceVerticleFactory
and always created a parent injector, but this caused a problem...but I don't recall what it was.
I have pushed up a commit 9b7b7cb0b00ff5c0049923e6c4feb2ac62221acf with integration test that should address your issue. Does that work for you?
Works for me.
Released 2.3.1
Many thanks @adrianluisgonzalez ! :)
Using
vertx-guice 2.3.0
, we currently can not have singleton scope binding of types that depends onio.vertx.core.Vertx
. By "singleton scope", I mean sharing a singleton instance along many Verticle.One way to achieve this is by getting a
GuiceVerticleFactory
fromthis.getVertx().verticleFactories()
and getting the setting the current injector (At "application start"), with the following bindings:SomeSigletonDependsOnVertx
will be singleton across all verticles (created by GuiceVerticleFactory).This will throw an Exception
com.google.inject.CreationException
at com.englishtown.vertx.guice.GuiceVertxBinder because this binding is already configured in parent Injector.One way to fix this is move com.englishtown.vertx.guice.GuiceVertxBinder binding to the parent injector.
Open for other solutions...