Package com.google.inject.spring
Class SpringIntegration
- java.lang.Object
-
- com.google.inject.spring.SpringIntegration
-
public class SpringIntegration extends Object
Integrates Guice with Spring.- Author:
- crazybob@google.com (Bob Lee)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
bindAll(com.google.inject.Binder binder, org.springframework.beans.factory.ListableBeanFactory beanFactory)
Binds all Spring beans from the given factory by name.static <T> com.google.inject.Provider<T>
fromSpring(Class<T> type, String name)
Creates a provider which looks up objects from Spring using the given name.
-
-
-
Method Detail
-
fromSpring
public static <T> com.google.inject.Provider<T> fromSpring(Class<T> type, String name)
Creates a provider which looks up objects from Spring using the given name. Expects a binding toBeanFactory
. Example usage:bind(DataSource.class) .toProvider(fromSpring(DataSource.class, "dataSource"));
-
bindAll
public static void bindAll(com.google.inject.Binder binder, org.springframework.beans.factory.ListableBeanFactory beanFactory)
Binds all Spring beans from the given factory by name. For a Spring bean named "foo", this method creates a binding to the bean's type and@Named("foo")
.- See Also:
Named
,Names.named(String)
-
-