Package com.google.inject

Examples of com.google.inject.Module


*/
public class JpaGuiceModuleProvider extends ModuleProviderTemplate{
  @Override
  public List<Module> getModules() {
    List<Module> modules = new ArrayList<Module>(0);
    modules.add(new Module() {
      @Override
      public void configure(Binder binder) {
        binder.bind(EntityManagerFactory.class).toProvider(
            EntityManagerFactoryProvider.class);
        binder.bind(EntityManager.class).toProvider(
View Full Code Here


  }

  @Override
  public List<Module> getModules() {
    List<Module> modules = new ArrayList<Module>(0);
    modules.add(new Module() {
      @Override
      public void configure(Binder binder) {
        binder.bind(SqlMapClient.class).toProvider(
            SqlMapClientProvider.class);
View Full Code Here

         {
            try
            {
               logger.info("found module: {0}", moduleString);
               final Class clazz = Thread.currentThread().getContextClassLoader().loadClass(moduleString.trim());
               final Module module = (Module) clazz.newInstance();
               result.add(module);
            }
            catch (ClassNotFoundException e)
            {
               throw new RuntimeException(e);
View Full Code Here

   }

   @Test
   public void testProvider()
   {
      final Module module = new Module()
      {
         public void configure(final Binder binder)
         {
            binder.bind(TestExceptionProvider.class);
            binder.bind(TestResource.class).to(TestResourceException.class);
View Full Code Here

   }

   @Test
   public void testMethodInjection()
   {
      final Module module = new Module()
      {
         public void configure(final Binder binder)
         {
            binder.bind(MethodTestResource.class);
         }
View Full Code Here

   }

   @Test
   public void testFieldInjection()
   {
      final Module module = new Module()
      {
         public void configure(final Binder binder)
         {
            binder.bind(FieldTestResource.class);
         }
View Full Code Here

   }

   //@Test // not (yet) supprted
   public void testConstructorInjection()
   {
      final Module module = new Module()
      {
         public void configure(final Binder binder)
         {
            binder.bind(ConstructorTestResource.class);
         }
View Full Code Here

   }

   @Test
   public void testResourceRegistered()
   {
      final Module module = new Module()
      {
         public void configure(final Binder binder)
         {
            binder.bind(TestResource.class).to(TestResourceSimple.class);
         }
View Full Code Here

   }

   @Test
   public void testResourceInjected()
   {
      final Module module = new Module()
      {
         public void configure(final Binder binder)
         {
            binder.bind(String.class).toInstance("injected-name");
            binder.bind(TestResource.class).to(TestResourceInjected.class);
View Full Code Here

   }

   @Test
   public void testInjection()
   {
      final Module module = new Module()
      {
         public void configure(final Binder binder)
         {
            binder.bind(TestResource.class).to(JaxrsTestResource.class);
         }
View Full Code Here

TOP

Related Classes of com.google.inject.Module

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.