[seam-dev] @Unwrap implementation in weld-extensions
Marius Bogoevici
marius.bogoevici at gmail.com
Tue Apr 20 12:06:30 EDT 2010
On 10-04-20 11:31 AM, Lincoln Baxter, III wrote:
> Wait -- there's no "Prototype" or "always new" scope?
@Dependent or @New, from case to case.
>
> --Lincoln
>
> On Tue, Apr 20, 2010 at 6:45 AM, Stuart Douglas
> <stuart at baileyroberts.com.au <mailto:stuart at baileyroberts.com.au>> wrote:
>
> I don't think I will be able to implement the injection of
> InjectionPoint into the producer method, but other than that it
> should be possible to implement.
>
> Stuart
>
>
> On 20/04/2010, at 8:15 PM, Pete Muir wrote:
>
> > Yes, I agree. I had raised this issue during spec development -
> that there was no truly stateless scope in CDI, where the bean
> instance was created every time.
> >
> > I would like to hear from the 299 EG about this as well.
> >
> > On 20 Apr 2010, at 04:57, Stuart Douglas wrote:
> >
> >> I think that there is a real use case for something similar to
> the @Unwrap feature of seam 2.
> >>
> >> I think that it would be possible to implement something like this:
> >>
> >> @ConversationScoped
> >> public class ManagedPersistenceContext
> >> {
> >>
> >> EntityManager entityManager;
> >>
> >> @Unwrap
> >> @SomeQualifier
> >> public EntityManager produce(InjectionPoint injectionPoint)
> >> {
> >> entityManager.joinTransaction();
> >> return entityManager;
> >> }
> >> }
> >>
> >> public class MyClass
> >> {
> >> @Inject @SomeQualifier EntityManager entityManager;
> >> }
> >>
> >> the way I envisage this working is that a proxy gets injected
> into MyClass, and this proxy calls
> ManagedPersistenceContext.produce to resolve the correct
> EntityManager to pass the call to every time a method is invoked
> on the proxy.
> >>
> >> I am pretty sure I can implement this in weld-extensions using
> JDK proxies, does this sound like a good idea?
> >>
> >> Stuart
> >> _______________________________________________
> >> seam-dev mailing list
> >> seam-dev at lists.jboss.org <mailto:seam-dev at lists.jboss.org>
> >> https://lists.jboss.org/mailman/listinfo/seam-dev
> >
>
>
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org <mailto:seam-dev at lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/seam-dev
>
>
>
>
> --
> Lincoln Baxter, III
> http://ocpsoft.com
> http://scrumshark.com
> "Keep it Simple"
>
>
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20100420/3a7738e0/attachment-0001.html
More information about the seam-dev
mailing list