i don't use @Resource but a name convention. It is not perfect but as we
can inject Class<?> the only way could be to add a custom type which will
be useless.

- Romain


2012/3/9 David Blevins <[email protected]>

>
> On Mar 9, 2012, at 1:46 AM, Romain Manni-Bucau wrote:
>
> > Hi David,
> >
> > it was not managed by CDI and injections was not working so well.
>
> Sounds like we need a JIRA for this titled "@Inject support for @Proxy
> bean handlers"
>
> A unit test might be great for that as well.  The loop that recreates all
> the injections looks a little fishy and could probably be improved, but I
> don't breaking the untested code.
>
> > i added too a way to inject the interface because when you are doing a
> > little bit generic handler you often need it.
>
> Are we reusing @Resource for that?  How do we identify the field to do the
> injection upon?
>
> > Do you see any issue with this change?
>
> Nope.  Just trying to understand.  With the volume of commits, there's no
> possible way I can fully digest them all in a short period of time, so
> asking questions :)
>
>
> -David
>
> > 2012/3/9 David Blevins <[email protected]>
> >
> >> 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);
> >>>
> >>>
> >>>
> >>
> >>
>
>

Reply via email to