Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's new in Google Guice 3?

Guice 3 is just around the corner, but I cannot find a page telling me what's new in this version. So, what's new in Guice 3?

like image 666
deamon Avatar asked Jan 13 '11 07:01

deamon


People also ask

Why we use Google Guice?

Beyond Dependency Injection, the benefits of using Google Guice is: Guice has a very clean implementation of constructor Injection. As you can see from the example you just add @Inject annotation constructor. Guice also has setter Injection using the same annotation.

What is @named annotation in Guice?

Dependency Injection for Java Developers with Dagger & Guice Guice provides another way also to map bindings without creating a custom annoation. It allows so using @Named annotation.

What are modules in Guice?

The Module is the core building block for an Injector which is Guice's object-graph builder. First step is to create an injector and then we can use the injector to get the objects. public static void main(String[] args) { /* * Guice.createInjector() takes Modules, and returns a new Injector * instance.

What is @inject in Guice?

Annotation Type Inject. @Target(value={METHOD,CONSTRUCTOR,FIELD}) @Retention(value=RUNTIME) @Documented public @interface Inject. Annotates members of your implementation class (constructors, methods and fields) into which the Injector should inject values.


1 Answers

The Guice 3.0 wiki page has a whole section entitled "New Features" along with a bit on migration.

I suspect that the feature which is in some ways most welcome while also not providing genuinely new functionality is JSR 330 integration.

like image 155
Jon Skeet Avatar answered Oct 19 '22 18:10

Jon Skeet