I'd like to inject a Session into a few of my beans. I believe the
correct way to do this is to use the
@Resource(name="java:comp/env/mail") annotation, but I would like to
be less verbose (if possible), and just use @Current, so I have done
the following:

@ApplicationScoped
public class Producers {

        @Resource(name="java:comp/env/jdbc/subetha")
        DataSource ds;

        @Resource(name="java:comp/env/mail")
        Session ses;

        @Produces //@Name("subetha")
        Session createMailSession(){
                return this.ses;
        }
        
        @Produces @Name("subetha")
        DataSource createSubethaDS(){
                return this.ds;
        }
}

But this produces a stack overflow with reference to the sess field
injection. It seems like it is actually getting this producer factory
from the inject manager and trying to use its own "createMailSession"
method (recursively) to do the injection.This seems very bad :(  , or
have i misunderstood how this is supposed to work?

Thanks in advance,
Scott


_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to