I thought we already supported injection on the handler. What problem is this aimed at?
-David On Mar 5, 2012, at 6:02 PM, [email protected] wrote: > Author: rmannibucau > Date: Tue Mar 6 00:02:21 2012 > New Revision: 1297301 > > URL: http://svn.apache.org/viewvc?rev=1297301&view=rev > Log: > ability to get injection in dynamic proxy handler + implicit injection of the > proxies interface > > Modified: > > openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java > > Modified: > openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java > URL: > http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java?rev=1297301&r1=1297300&r2=1297301&view=diff > ============================================================================== > --- > openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java > (original) > +++ > openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java > Tue Mar 6 00:02:21 2012 > @@ -1279,11 +1279,27 @@ public class BeanContext extends Deploym > > // Create bean instance > final Object beanInstance; > - final InjectionProcessor injectionProcessor = new > InjectionProcessor(beanConstructor.create(creationalContext), > this.getInjections(), InjectionProcessor.unwrap(ctx)); > + final InjectionProcessor injectionProcessor; > if (!isDynamicallyImplemented()) { > + injectionProcessor = new > InjectionProcessor(beanConstructor.create(creationalContext), > getInjections(), InjectionProcessor.unwrap(ctx)); > beanInstance = injectionProcessor.createInstance(); > inject(beanInstance, creationalContext); > } else { > + // update target > + final List<Injection> newInjections = new > ArrayList<Injection>(); > + for (Injection injection : getInjections()) { > + if (beanClass.equals(injection.getTarget())) { > + final Injection updated = new > Injection(injection.getJndiName(), injection.getName(), > beanDefinition.getBeanClass()); > + newInjections.add(updated); > + } else { > + newInjections.add(injection); > + } > + } > + injections.clear(); > + injections.addAll(newInjections); > + > + injectionProcessor = new > InjectionProcessor(beanConstructor.create(creationalContext), injections, > InjectionProcessor.unwrap(ctx)); > + injectionProcessor.setProperty("implementingInterfaceClass", > beanClass); > InvocationHandler handler = (InvocationHandler) > injectionProcessor.createInstance(); > beanInstance = DynamicProxyImplFactory.newProxy(this, > handler); > inject(handler, creationalContext); > > >
