<div dir="ltr">I agree. Ill stick to ApplicationScope until the practicalities are sorted out. <div><br></div><div>Thanks for the deeper clarification.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Sep 7, 2013 at 9:42 PM, Mark Struberg <span dir="ltr"><<a href="mailto:struberg@yahoo.de" target="_blank">struberg@yahoo.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">No, I don't expect users to read the TCK - but it's binding for the container vendors.<br>
<br>
Again: I completely agree with Martin with his advice to not use @javax.inject.Singleton in CDI projects as it is really underspecified in JSR-330 already. And JSR-299 does not add any wording to make things more clear.<br>
<br>
But the fuzzyness around @Singleton is mainly about it's lifecycle, etc. The requirement for @PostConstruct and @PreDestroy support is otoh actually pretty well defined in atinject imo.<br>
<div class="im"><br>
<br>
LieGrue,<br>
strub<br>
<br>
<br>
<br>
>________________________________<br>
> From: Kristoffer Sjögren <<a href="mailto:stoffe@gmail.com">stoffe@gmail.com</a>><br>
>To: Mark Struberg <<a href="mailto:struberg@yahoo.de">struberg@yahoo.de</a>><br>
>Cc: Martin Kouba <<a href="mailto:mkouba@redhat.com">mkouba@redhat.com</a>>; "<a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a>" <<a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a>><br>
</div>>Sent: Saturday, 7 September 2013, 21:11<br>
<div class="HOEnZb"><div class="h5">>Subject: Re: [weld-dev] PostConstruct & PreDestroy in Java SE<br>
><br>
><br>
><br>
><a href="http://docs.jboss.org/cdi/spec/1.1/cdi-spec.pdf" target="_blank">http://docs.jboss.org/cdi/spec/1.1/cdi-spec.pdf</a> "1.2.4 Relationship to Dependency Injection for Java" is what you referring to I suppose? But there is no telling how to use it. Also, its a bit unfortunate that we have two Singleton annotations, begging for confusion.<br>
><br>
><br>
>Nevermind vagueness, but do you expect users to read the TCK? Not trying criticize, there may be room for improvement here no?<br>
><br>
><br>
><br>
><br>
><br>
><br>
>On Sat, Sep 7, 2013 at 8:57 PM, Mark Struberg <<a href="mailto:struberg@yahoo.de">struberg@yahoo.de</a>> wrote:<br>
><br>
><br>
>><br>
>>No, the TCK is part of the deliverable for the specification. As is the API JavaDoc.<br>
>><br>
>>Also the spec mentions the 'Injection for Java' specification (== JSR-330) as reference.<br>
>><br>
>><br>
>>LieGrue,<br>
>>strub<br>
>><br>
>><br>
>><br>
>>>________________________________<br>
>>> From: Kristoffer Sjögren <<a href="mailto:stoffe@gmail.com">stoffe@gmail.com</a>><br>
>>>To: Mark Struberg <<a href="mailto:struberg@yahoo.de">struberg@yahoo.de</a>><br>
>>>Cc: Martin Kouba <<a href="mailto:mkouba@redhat.com">mkouba@redhat.com</a>>; "<a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a>" <<a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a>><br>
>>>Sent: Saturday, 7 September 2013, 20:54<br>
>><br>
>>>Subject: Re: [weld-dev] PostConstruct & PreDestroy in Java SE<br>
>>><br>
>>><br>
>>><br>
>>>Alright, the specification and TCK is inconsistent. But as a user, I dont care about the TCK and it does not make sense to enforce requirements on the specification in the TCK. For users, strictly speaking, anything not stated in the specification is unsupported. Correct?<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> <br>
>>><br>
>>><br>
>>><br>
>>><br>
>>>On Sat, Sep 7, 2013 at 8:03 PM, Mark Struberg <<a href="mailto:struberg@yahoo.de">struberg@yahoo.de</a>> wrote:<br>
>>><br>
>>>And before there are any questions: it's not directly stated inside the CDI spec but in the TCK documentation:<br>
>>>><br>
>>>><a href="http://docs.jboss.org/cdi/tck/reference/1.0.4.SP1/pdf/jsr299-tck-reference-guide.pdf" target="_blank">http://docs.jboss.org/cdi/tck/reference/1.0.4.SP1/pdf/jsr299-tck-reference-guide.pdf</a><br>
>>>><br>
>>>>"JSR-330 - CDI builds on JSR-330, and as such JSR-299 implementations must additionally pass the JSR-330 TCK."<br>
>>>><br>
>>>>again: I agree with Martin that you should better not use it. But it should work nontheless.<br>
>>>><br>
>>>><br>
>>>>LieGrue,<br>
>>>>strub<br>
>>>><br>
>>>><br>
>>>><br>
>>>><br>
>>>>----- Original Message -----<br>
>>>><br>
>>>>> From: Mark Struberg <<a href="mailto:struberg@yahoo.de">struberg@yahoo.de</a>><br>
>>>>> To: Martin Kouba <<a href="mailto:mkouba@redhat.com">mkouba@redhat.com</a>>; Kristoffer Sjögren <<a href="mailto:stoffe@gmail.com">stoffe@gmail.com</a>><br>
>>>>> Cc: "<a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a>" <<a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a>><br>
>>>>> Sent: Saturday, 7 September 2013, 19:22<br>
>>>>> Subject: Re: [weld-dev] PostConstruct & PreDestroy in Java SE<br>
>>>>><br>
>>>>>T he wording is not correct.<br>
>>>><br>
>>>>><br>
>>>>> Each JSR-299 Container must _fully_ implement the JSR-330 specification and pass<br>
>>>>> the JSR-330 TCK. Thus each CDI Container MUST support javax.inject.Singleton.<br>
>>>>> But it's actually not really defined in detail how this scope should behave.<br>
>>>>> And the atinject and EE specs also define that @PostConstruct and @PreDestroy<br>
>>>>> must work for @Singleton beans. So this is imo a bug. But otoh I personally<br>
>>>>> would suggest to not use javax.inject.Singleton because of the aforementioned<br>
>>>>> underspecified behaviout.<br>
>>>>><br>
>>>>> LieGrue,<br>
>>>>> strub<br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>> ----- Original Message -----<br>
>>>>>> From: Martin Kouba <<a href="mailto:mkouba@redhat.com">mkouba@redhat.com</a>><br>
>>>>>> To: Kristoffer Sjögren <<a href="mailto:stoffe@gmail.com">stoffe@gmail.com</a>><br>
>>>>>> Cc: <a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a><br>
>>>>>> Sent: Friday, 6 September 2013, 14:31<br>
>>>>>> Subject: Re: [weld-dev] PostConstruct & PreDestroy in Java SE<br>
>>>>>><br>
>>>>>> Actually there's no singleton scope and corresponding built-in context<br>
>>>>>> defined in the CDI spec. Though Weld API contains<br>
>>>>>> org.jboss.weld.context.SingletonContext. Also the docs are outdated<br>
>>>>>> (chapter 5.4. The singleton pseudo-scope). I think relevant classes<br>
>>>>>> should be deprecated and the docs updated.<br>
>>>>>><br>
>>>>>> With regard to lifecycle callbacks - Weld only invalidates application<br>
>>>>>> context during shutdown right now [1].<br>
>>>>>><br>
>>>>>> Martin<br>
>>>>>><br>
>>>>>> [1]<br>
>>>>>><br>
>>>>> <a href="https://github.com/weld/core/blob/master/impl/src/main/java/org/jboss/weld/bootstrap/WeldRuntime.java#L56" target="_blank">https://github.com/weld/core/blob/master/impl/src/main/java/org/jboss/weld/bootstrap/WeldRuntime.java#L56</a><br>
>>>>>><br>
>>>>>> Dne 6.9.2013 14:09, Kristoffer Sjögren napsal(a):<br>
>>>>>>> Hi<br>
>>>>>>><br>
>>>>>>> We're running Weld 2.0.3.Final in a Java SE environment and have<br>
>>>>>>> encountered a precarious situation where it seems like Weld is not<br>
>>>>>>> consistent in handling the lifecycle of singleton beans.<br>
>>>>>>><br>
>>>>>>> We have singleton beans with @PostConstruct and @PreDestroy methods.<br>
>>>>>>> During Weld.initialize() all @PostConstruct methods are called. But<br>
>>>>>>> during @PreDestroy methods are never called during Weld.shutdown().<br>
>>>>>>> @PreDestroy is only called on beans which are @ApplicationScoped.<br>
>>>>>>><br>
>>>>>>> Is this according to specification or a bug?<br>
>>>>>>><br>
>>>>>>> Cheers,<br>
>>>>>>> -Kristoffer<br>
>>>>>>><br>
>>>>>>><br>
>>>>>>> _______________________________________________<br>
>>>>>>> weld-dev mailing list<br>
>>>>>>> <a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a><br>
>>>>>>> <a href="https://lists.jboss.org/mailman/listinfo/weld-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/weld-dev</a><br>
>>>>>>><br>
>>>>>><br>
>>>>>> _______________________________________________<br>
>>>>>> weld-dev mailing list<br>
>>>>>> <a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a><br>
>>>>>> <a href="https://lists.jboss.org/mailman/listinfo/weld-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/weld-dev</a><br>
>>>>>><br>
>>>>><br>
>>>>> _______________________________________________<br>
>>>>> weld-dev mailing list<br>
>>>>> <a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a><br>
>>>>> <a href="https://lists.jboss.org/mailman/listinfo/weld-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/weld-dev</a><br>
>>>>><br>
>>>><br>
>>><br>
>>><br>
>>><br>
>><br>
><br>
><br>
><br>
</div></div></blockquote></div><br></div>