I'm currently designing a dependency injection solution for use within
application state objects that I'd also like to use elsewhere in my
application.

The idea is simple - I have a set of services that I need to use throughout
the app for which I don't want to be passing references around.  
A good example is the Vlib sample that ships with Tap4.  Taking a look at
the Visit object, it requires an IRequestCycle object to be passed in to get
the current user - I'd like to do away with this.

// Copied from Vlib - Visit.java
// Don't want to be passing this around!
public Person getUser(IRequestCycle cycle)
{
    ...
    VirtualLibraryEngine vengine = (VirtualLibraryEngine) cycle.getEngine();
    _user = vengine.readPerson(_userId);
    ...
}

What I'd like to do is simply annotate my Visit object and, with the right
HiveMind configuration, have it retrieve a request specific reference to
necessary application services.
Something like the following (additional notes inline):

public class Visit implements Serializable {

        /*
         * This should retrieve an object created or retrieved
         * from a pool and bound to the current request (thread).
         * AppServices will have injected objects of its own 
         * (references to EJBs, etc.)
         */
        @InjectObject("service:myapp.services")
        public abstract AppServices getAppServices()
        {
        }
}


Any idea on how to get this to work properly and efficiently (including the
nested HiveMind annotations within AppServices)?

-Lance


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to