com.google.inject.spring

Class SpringIntegration



  • public class SpringIntegration
    extends Object
    Integrates Guice with Spring.
    Author:
    crazybob@google.com (Bob Lee)
    • 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 to BeanFactory. 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)

Copyright © 2006–2018 Google, Inc.. All rights reserved.