<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div>Hi;<br><br>Actually the spec requires to return Proxy objects from the Manager.getInstance(). So the dependency injection does not occur until Bean method is called, i.o.w Context.get() is not called before the any method calls on the Bean. <br><br>So, circular reference may not be happened with Proxy usage.<br><br>Gurkan<br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Gavin King <gavin@hibernate.org><br><b><span style="font-weight: bold;">To:</span></b> Scott Ferguson <ferg@caucho.com><br><b><span style="font-weight: bold;">Cc:</span></b> Michael Keith <michael.keith@oracle.com>;
WebBeans <webbeans-dev@lists.jboss.org>; Java Community Process JSR #299 Expert List <JSR-299-EG@jcp.org><br><b><span style="font-weight: bold;">Sent:</span></b> Friday, January 2, 2009 6:29:46 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [webbeans-dev] Re: Bean.getInjectionPoints()<br></font><br>
On Fri, Jan 2, 2009 at 2:37 PM, Scott Ferguson <<a ymailto="mailto:ferg@caucho.com" href="mailto:ferg@caucho.com">ferg@caucho.com</a>> wrote:<br>><br>> On Dec 30, 2008, at 1:35 PM, Gavin King wrote:<br>><br>>> The spec requires that injection points be validated at init time for<br>>> any Bean (for XxxxxDependencyException).<br>>><br>>> Nick from the RI team has noticed that for this to be implementable,<br>>> we need to add metadata about the injection points of a bean to the<br>>> Bean interface.<br>><br>> It shouldn't be necessary, since "SimpleBean implements Bean" should be<br>> responsible for its own validation. It doesn't make sense for the Manager<br>> implementation to validate the Bean, since that breaks the encapsulation<br>> model of both Manager and Bean. It's cleaner for Manager to assume the Bean<br>> is valid.<br><br>That only works for Bean implementations
provided in the<br>specification. It does not work for Bean implementations provided by<br>3rd-party extensions. We need the dependency validation stuff to work<br>in the second case also.<br><br>> On a related note, it would be cleaner if the Bean.create() method was<br>> changed to Bean.create(Context) in order to handle circular references.<br>><br>> The logic of Bean.create(Context) would be<br>> 1. check if Bean is in Context (for circular ref), if so return the bean.<br>> 2. instantiate the Bean (do not inject/initialize) and put it in Context<br>> (so we have a ref)<br>> 3. inject/initialize the bean as usual (this may trigger the circular<br>> reference, which would be resolved by #1 on a second call).<br><br>Bean already has a reference to the Manager and can call<br>Manager.getContext(myScope). So the extra parameter would not be<br>necessary.<br><br>But what you're really saying is that it's better
to handle circular<br>references from Bean.create() than from Manager.getInstance(). OK,<br>that's really interesting, let me chat to Pete Muir about that and get<br>back to you.<br><br>-- <br>Gavin King<br><a ymailto="mailto:gavin.king@gmail.com" href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a><br><a href="http://in.relation.to/Bloggers/Gavin" target="_blank">http://in.relation.to/Bloggers/Gavin</a><br><a href="http://hibernate.org" target="_blank">http://hibernate.org</a><br><a href="http://seamframework.org" target="_blank">http://seamframework.org</a><br>_______________________________________________<br>webbeans-dev mailing list<br><a ymailto="mailto:webbeans-dev@lists.jboss.org" href="mailto:webbeans-dev@lists.jboss.org">webbeans-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/webbeans-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/webbeans-dev</a><br></div></div></div><br>
</body></html>