ef-labs / vertx-guice

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

Logging an error when no binder class is found doesn't always make sense #11

Closed dano closed 8 years ago

dano commented 8 years ago

Currently, if no bootstrap binder is provided in an injected Verticle's config, and the default bootstrap binder class isn't found on the classpath, an error is logged. While this scenario sometimes indicates that the client has mistakenly forgotten to include a binder class in the Verticle's config, there are valid use-cases where you wouldn't do this. Specifically:

  1. You are using a parent Injector, and don't need any additional modules aside from what's already provided by the parent.
  2. You're injecting objects that only require the GuiceVertxBinder to be constructed. The GuiceVertxBinder is provided by default, so no additional binder needs to be provided in the Verticle's config. (Though arguably you don't need to be using DI for this use-case.)

I propose that instead of logging an error when no binder is found, a warning is logged, but only in cases where a parent module isn't present. I'd be happy to provide a PR for this, if you agree with the change.

adrianluisgonzalez commented 8 years ago

Fair points. A PR would be great, thanks.

dano commented 8 years ago

Just opened #13.