Package com.google.inject.spring
Class SpringIntegration
- java.lang.Object
-
- com.google.inject.spring.SpringIntegration
-
public class SpringIntegration extends Object
Integrates Guice with Spring.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
bindAll(Binder binder, org.springframework.beans.factory.ListableBeanFactory beanFactory)
Binds all Spring beans from the given factory by name.static <T> 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> 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(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)
-
-