Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
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 ?

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