Posts

Showing posts from December, 2010

My First Google Guice Application

Google Guice is a simple yet interesting Dependency Injector for I just wrote my first Guice application in netbeans. It is a very basic application but was good enough to do a head start. First you need to download Guice from gooogle code site from http :// code . google . com / p / google - guice / . In the zip you will find two jars called guice-2.0.jar and aopalliance.jar which you need to create your application. First you need to create a normal java application project and then add the above two jar’s in the project as library. I started with a simple interface like this package firstguice.interfaces; public interface IGreeter { public void sayHello (); } Next I created the implementation of this as the following code package firstguice.impl; import firstguice.interfaces.IGreeter; public class ConsoleGreeter implements IGreeter { public void sayHello () { System. out .println( "Hi there, this is the console greeter" ); } } After the implemen