Activity Not Available
0
I Use This!

Project Summary

Analyzed over 2 years ago. based on code collected over 2 years ago.

Status: proof of concept, seeking Feedback

"Here's one I made earlier."

Hoime aims to simplify the use of existing dependency injection frameworks by eliminating explicit injection code. This is achieved by weaving injection requests into object constructors as required.

The goal is to move from this:

Injector injector = ...
Greeter g = new Greeter("Richard");
injector.injectMembers(g);
assertEquals("Hello Richard", g.getText());to this:

Greeter g = new Greeter("Richard");
assertEquals("Hello Richard", g.getText());Basic usage is as follows.

Determine which classes to include/exclude from transparent injection, before any injectable classes have been loaded:

InjectionContext.setIncludedClasses("hoime.guice.**");Configure the dependency injection framework you are using, Guice in this case.

Module module = new AbstractModule() {
protected void configure() {
bind(String.class).toInstance("Moshimoshi");
}
};
Injector injector = Guice.createInjector(module);Attach it to hoime:

InjectionContext.setInjector(new GuiceInjector(injector));Start using your transparently injected objects:

String greeting = new Greeter("Richard").getText();
assertEquals("Moshimoshi Richard", greeting);Now run your application, passing in the hoime jar as a javaagent:

java -javaagent:hoime-1.0.jar ...Currently there is support for Guice, Spring and Pico dependency injection. Constructor injection is not supported. See test suites for examples.

Share

In a Nutshell, hoime...

Activity

30 Day Summary

Mar 21 2014 — Apr 20 2014

12 Month Summary

Apr 20 2013 — Apr 20 2014

Community

Ratings

Be the first to rate this project
 
Click to add your rating
   Spinner f6ecff617ec2ba7f559e6f535cad9b70a3f91120737535dab4d4548a6c83576c
 
Review this Project!