Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdi-dev] Regarding annotations

No, interceptors have nothing to do with normal/pseudo scope behaviour.
Adding an interceptor in practice means creating a subclass of the bean that is aware of the interception logic.

Those two are different concepts. If you have proxied bean (app scoped for instance) and add an interceptor to it, then you will have to create both - a proxy and a subclass.

Matej

----- Original Message -----
> From: "Emily Jiang" <emijiang6@xxxxxxxxxxxxxx>
> To: "cdi developer discussions" <cdi-dev@xxxxxxxxxxx>, "Matej Novotny" <manovotn@xxxxxxxxxx>
> Sent: Monday, December 14, 2020 7:53:36 PM
> Subject: Re: [cdi-dev] Regarding annotations
> 
> Straightly speaking, if you attach an interceptor on the bean with
> `@Singleton`, you will get a proxy, right @Matej Novotny
> <manovotn@xxxxxxxxxx> ?
> 
> Thanks
> Emily
> 
> On Mon, Dec 14, 2020 at 3:06 PM arjan tijms <arjan.tijms@xxxxxxxxx> wrote:
> 
> > Hi,
> >
> > On Mon, Dec 14, 2020 at 4:00 PM Matej Novotny <manovotn@xxxxxxxxxx> wrote:
> >
> >> I would be -1 to remove Singleton, I see it used pretty commonly. The
> >> main difference from app scoped is that while they are both "one instance
> >> per container", application scope uses proxies, whereas singleton doesn't.
> >> This usually doesn't matter, but there are cases (more prominent in build
> >> time environment, or when it comes to serialization, or where you want
> >> lazy
> >> init, ...) in which the difference matters and being able to choose is
> >> nice.
> >> If anything, I would rather add Singleton as a bean defining annotation
> >> into CDI.
> >>
> >
> > +1 for that latter, and make it clear in the documentation that in
> > CDI @Singleton is not proxied, where @ApplicationScoped is.
> >
> > Kind regards,
> > Arjan
> >
> >
> > _______________________________________________
> > cdi-dev mailing list
> > cdi-dev@xxxxxxxxxxx
> > To unsubscribe from this list, visit
> > https://www.eclipse.org/mailman/listinfo/cdi-dev
> >
> 
> 
> --
> Thanks
> Emily
> 



Back to the top