[weld-dev] PostConstruct & PreDestroy in Java SE
Kristoffer Sjögren
stoffe at gmail.com
Fri Sep 6 10:52:14 EDT 2013
Ok that make sense. Thanks for the clarification!
On Fri, Sep 6, 2013 at 4:17 PM, Martin Kouba <mkouba at redhat.com> wrote:
> javax.inject.Singleton was never supported in CDI 1.0 and 1.1 (final
> versions). So it actually cannot be abandoned by CDI :-). But yes, I
> think we should deprecate its usage in Weld API and remove the mentioned
> chapter from docs. So that only @ApplicationScoped beans should be used.
>
> Martin
>
> Dne 6.9.2013 15:40, Kristoffer Sjögren napsal(a):
> > Do you mean that Singleton should be abandoned by CDI? Or do you mean to
> > clarify its role and/or implement proper lifecycle support for them?
> >
> >
> > On Fri, Sep 6, 2013 at 2:31 PM, Martin Kouba <mkouba at redhat.com
> > <mailto:mkouba at redhat.com>> wrote:
> >
> > Actually there's no singleton scope and corresponding built-in
> context
> > defined in the CDI spec. Though Weld API contains
> > org.jboss.weld.context.SingletonContext. Also the docs are outdated
> > (chapter 5.4. The singleton pseudo-scope). I think relevant classes
> > should be deprecated and the docs updated.
> >
> > With regard to lifecycle callbacks - Weld only invalidates
> application
> > context during shutdown right now [1].
> >
> > Martin
> >
> > [1]
> >
> https://github.com/weld/core/blob/master/impl/src/main/java/org/jboss/weld/bootstrap/WeldRuntime.java#L56
> >
> > Dne 6.9.2013 14:09, Kristoffer Sjögren napsal(a):
> > > Hi
> > >
> > > We're running Weld 2.0.3.Final in a Java SE environment and have
> > > encountered a precarious situation where it seems like Weld is not
> > > consistent in handling the lifecycle of singleton beans.
> > >
> > > We have singleton beans with @PostConstruct and @PreDestroy
> methods.
> > > During Weld.initialize() all @PostConstruct methods are called. But
> > > during @PreDestroy methods are never called during Weld.shutdown().
> > > @PreDestroy is only called on beans which are @ApplicationScoped.
> > >
> > > Is this according to specification or a bug?
> > >
> > > Cheers,
> > > -Kristoffer
> > >
> > >
> > > _______________________________________________
> > > weld-dev mailing list
> > > weld-dev at lists.jboss.org <mailto:weld-dev at lists.jboss.org>
> > > https://lists.jboss.org/mailman/listinfo/weld-dev
> > >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20130906/ca7d9af1/attachment.html
More information about the weld-dev
mailing list