[cdi-dev] Would @PostActivate, @PrePassivate and @Remove make sense in JSR 250 ?
pmuir at redhat.com
Wed Jan 7 07:59:15 EST 2015
> On 28 Dec 2014, at 12:38, Antonio Goncalves <antonio.goncalves at gmail.com> wrote:
> Hi all,
> I was playing with @SessionScoped beans... and wondered if @PostActivate, @PrePassivate and @Remove would make sense in JSR 250 ?
> At the moment these annotations belong to the javax.ejb package and are only used in @Stateful EJBs. With CDI scopes, we end up with a few "stateful" scopes (@SessionScoped, but also @ConversationScoped, @ViewScoped...) so why not having the same functionality in CDI ? @PreDestroy and @PostConstruct are already part of JSR 250. So why not having @PostActivate and @PrePassivate as well so they could be used in every bean ?
> BTW, while I was playing with @SessionScoped beans, I asked Antoine to show me how to remove a bean from the session. It's only a few lines of code, but again, why not having a @Remove annotation that does that (the exact same one of javax.ejb.Remove) ?
I always found @Remove extremely weird, I think removing a bean instance should be an explicit action, not an side effect of calling some other method.
> To summarize, why not taking some of those stateful EJB concerns back to JSR 250 so they could be used anywhere ?
> Any thoughts ?
> Antonio Goncalves
> Software architect, Java Champion and Pluralsight author
> Web site <http://www.antoniogoncalves.org/> | Twitter <http://twitter.com/agoncal> | LinkedIn <http://www.linkedin.com/in/agoncal> | Pluralsight <http://pluralsight.com/training/Authors/Details/antonio-goncalves> | Paris JUG <http://www.parisjug.org/> | Devoxx France <http://www.devoxx.fr/>_______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cdi-dev