@Test public void createsInstance() throws Exception { Object instance = new Object(); when(constructorDescriptor.createInstance(applicationContext)).thenReturn(instance); Object result = perRequestObjectFactory.getInstance(applicationContext); assertSame(instance, result); }
@Override public Object getInstance(ApplicationContext context) { ConstructorDescriptor constructorDescriptor = model.getConstructorDescriptors().get(0); Object object = constructorDescriptor.createInstance(context); List<FieldInjector> fieldInjectors = model.getFieldInjectors(); if (fieldInjectors != null && fieldInjectors.size() > 0) { for (FieldInjector injector : fieldInjectors) { injector.inject(object, context); } } doPostConstruct(object, context); return object; }
PerRequestObjectFactory implements ObjectFactory<T> { @Override public Object getInstance(ApplicationContext context) { ConstructorDescriptor constructorDescriptor = model.getConstructorDescriptors().get(0); Object object = constructorDescriptor.createInstance(context); List<FieldInjector> fieldInjectors = model.getFieldInjectors(); if (fieldInjectors != null && fieldInjectors.size() > 0) { for (FieldInjector injector : fieldInjectors) { injector.inject(object, context); } } doPostConstruct(object, context); return object; } }
PerRequestObjectFactory implements ObjectFactory<T> { @Override public Object getInstance(ApplicationContext context) { ConstructorDescriptor constructorDescriptor = model.getConstructorDescriptors().get(0); Object object = constructorDescriptor.createInstance(context); List<FieldInjector> fieldInjectors = model.getFieldInjectors(); if (fieldInjectors != null && fieldInjectors.size() > 0) { for (FieldInjector injector : fieldInjectors) { injector.inject(object, context); } } doPostConstruct(object, context); return object; } PerRequestObjectFactory(T model); }
PerRequestObjectFactory implements ObjectFactory<T> { @Override public Object getInstance(ApplicationContext context) { ConstructorDescriptor constructorDescriptor = model.getConstructorDescriptors().get(0); Object object = constructorDescriptor.createInstance(context); List<FieldInjector> fieldInjectors = model.getFieldInjectors(); if (fieldInjectors != null && fieldInjectors.size() > 0) { for (FieldInjector injector : fieldInjectors) { injector.inject(object, context); } } doPostConstruct(object, context); return object; } PerRequestObjectFactory(T model); @Override Object getInstance(ApplicationContext context); @Override T getObjectModel(); }
PerRequestObjectFactory implements ObjectFactory<T> { @Override public Object getInstance(ApplicationContext context) { ConstructorDescriptor constructorDescriptor = model.getConstructorDescriptors().get(0); Object object = constructorDescriptor.createInstance(context); List<FieldInjector> fieldInjectors = model.getFieldInjectors(); if (fieldInjectors != null && fieldInjectors.size() > 0) { for (FieldInjector injector : fieldInjectors) { injector.inject(object, context); } } doPostConstruct(object, context); return object; } PerRequestObjectFactory(T model); @Override Object getInstance(ApplicationContext context); @Override T getObjectModel();  }