Add support for bean names

Users can in inject Spring beans by name in Guice using
@Named, or they can inject Guice beans in Spring as long
as they have @Named providers.

Fixes gh-7
This commit is contained in:
Dave Syer
2016-06-02 10:23:14 +01:00
parent 72cf5256e8
commit 1002284360
14 changed files with 432 additions and 79 deletions

View File

@@ -18,6 +18,7 @@ import javax.inject.Singleton;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.name.Names;
/**
* @author Dave Syer
@@ -36,7 +37,8 @@ public class GuiceWiringTests extends AbstractCompleteWiringTests {
protected void configure() {
bind(Service.class).to(MyService.class);
bind(Baz.class).in(Singleton.class);
bind(Thang.class).annotatedWith(Names.named("thing")).to(Thang.class);
}
}
}