ef-labs / vertx-guice

Create Vert.x Modules and Verticles with dependency injection using Guice
MIT License
59 stars 24 forks source link

Allow having Injectors per Verticle or one Injector for all Verticles #7

Closed jklingsporn closed 8 years ago

jklingsporn commented 9 years ago

Hi, I'm following up on the discussion created at https://groups.google.com/forum/?fromgroups=#!topic/vertx/p-ZcfEy6Sp0 Currently, when deploying more than one Verticle, an Injector is created for each Verticle. That means that singletons are Verticle-scoped. I created an option to have one global Injector, in case you have Threadsafe-Singleton-Objects which can be shared across Verticles (e.g. Connection Pools). I provided also an integration test.

adrianluisgonzalez commented 8 years ago

Commit 3c9e04a8ac925e8b64c14abedc66a0b226039ba7 allows specifying a parent injector on the GuiceVerticleFactory which allows singletons across Verticles.

For more details, see issue #9