Would it be possible to implement a scope that just doesn&#39;t store the instance? It would be like a request scope, except it would just skip adding it to the context so a new one each time it&#39;s accessed.<div><br></div>
<div>That&#39;s basically how the stateless scope was done in Seam 2. The @Unwrap was something extra in Seam 2 since the injections were not proxy-based. We can merge the two ideas into a truly stateless scope since producers create first-class beans in CDI.<div>
<br></div><div>-Dan<br><br><div class="gmail_quote">On Tue, Jun 8, 2010 at 6:09 AM, Stuart Douglas <span dir="ltr">&lt;<a href="mailto:stuart@baileyroberts.com.au">stuart@baileyroberts.com.au</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"></div><br><div style="word-wrap:break-word"><div><br></div><div>I just tried to implement this and it did not work, and after looking at the spec even if it did work I don&#39;t think it would be portable due to the following language:</div>
<div><br></div><div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><i>Suppose beans </i><span style="font:8.0px Helvetica"><i>A</i></span><i>, </i><span style="font:8.0px Helvetica"><i>B </i></span><i>and </i><span style="font:8.0px Helvetica"><i>Z </i></span><i>all have normal scopes. Suppose </i><span style="font:8.0px Helvetica"><i>A </i></span><i>has an injection point </i><span style="font:8.0px Helvetica"><i>x</i></span><i>, and </i><span style="font:8.0px Helvetica"><i>B </i></span><i>has an injection point </i><span style="font:8.0px Helvetica"><i>y</i></span><i>. Suppose</i></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><i>further that both </i><span style="font:8.0px Helvetica"><i>x </i></span><i>and </i><span style="font:8.0px Helvetica"><i>y </i></span><i>resolve to bean </i><span style="font:8.0px Helvetica"><i>Z </i></span><i>according to the rules of typesafe resolution. If </i><span style="font:8.0px Helvetica"><i>a </i></span><i>is the current instance of</i></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="font:8.0px Helvetica"><i>A</i></span><i>, and </i><span style="font:8.0px Helvetica"><i>b </i></span><i>is the current instance of </i><span style="font:8.0px Helvetica"><i>B</i></span><i>, then both </i><span style="font:8.0px Helvetica"><i>a.x </i></span><i>and </i><span style="font:8.0px Helvetica"><i>b.y </i></span><i>refer to the same instance of </i><span style="font:8.0px Helvetica"><i>Z</i></span><i>. This instance is the current instance</i></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><i>of </i><span style="font:8.0px Helvetica"><i>Z</i></span><i>.</i></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<i><br></i></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><i><br></i></div></div><div><br></div><div>The other way of providing this is to provide an extension that uses javassist to create @Dependent scoped proxies, these proxies could then call the producer method on every invocation, however it requires a dependency on javassist.</div>
<div><br></div><div><br></div><div>Stuart</div><div><br><div><div>On 08/06/2010, at 3:19 AM, Pete Muir wrote:</div><br><blockquote type="cite"><div><br>On 7 Jun 2010, at 12:19, Stuart Douglas wrote:<br><br><blockquote type="cite">
I have been thinking about adding a stateless scope to weld extensions, that would allow for a similar construct to @Unwrap from seam 2. Basically if you have a Stateless producer method the the producer will be called every time a method on the proxy is invoked. <br>
</blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The main downside that I can see is that beans that have a stateless scope no longer have a well defined lifecycle, so disposal methods etc will not be called, however as long as this is documented I don&#39;t think that this is much of a problem.<br>
</blockquote><br>Yeah, I think there is a strong case for providing this.</div></blockquote></div><br></div></div><br>_______________________________________________<br>
seam-dev mailing list<br>
<a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/seam-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/seam-dev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Dan Allen<br>Senior Software Engineer, Red Hat | Author of Seam in Action<br>Registered Linux User #231597<br><br><a href="http://mojavelinux.com">http://mojavelinux.com</a><br>
<a href="http://mojavelinux.com/seaminaction">http://mojavelinux.com/seaminaction</a><br><a href="http://www.google.com/profiles/dan.j.allen">http://www.google.com/profiles/dan.j.allen</a><br>
</div></div>