Do you think the Spring Framework is to heavy for your needs? But you want to use Dependency Injection?
Then we are on the same road, but due a lot of experiences with Spring I missed one Feature: Classpath Scanning.
After some research I found, that the only guys who thought about this topic, were the guys from Sonatype. They showed the dynamic possibilites with Guice. After starting using it, I found the dependencies of their toolkit were to heavy for "only Classpath Scanning" and Binding. There were also some design descisions in the APIs which I don't like, but it's only my personal opinion. The Extension is pretty nice!
So I started to create my own project. I wanted to have a Guice Module, which binds a Classpath Scanner, the Packages and the Features.
The result is a project (hosted at Github http://github.com/manzke/guice-automatic-injection) which provides 3 Classpath Scanner Implementations.
- My own, which is using pure Java-Classes and ASM
- Reflections, which is using Javassit (supports parallel Scanning!)
- Sonatype-Extension
They are all spread into their own projects, which you can add find in Maven.
After a successful scanning all Guice Modules annotated with @GuiceModule, will be installed into a child Injector. All classes annotated with @AutoBind will be bound to all inherited interfaces. You can also name it, which would lead to a named binding and overwrite the interfaces, which should be used.
And if you don't want to use all Features, just overwrite the StartupModule and bind only the Features you want or your own.
So stop typing the Bindings yourself, let "Automatic Injection/Binding for Guice" do it for you! :)
Bye,
Daniel