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:

public class Producers {

        DataSource ds;

        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,

resin-interest mailing list

Reply via email to