[jboss-dev-forums] [Design of POJO Server] - Re: Generalizing dependency injection

wolfc do-not-reply at jboss.com
Thu Mar 13 05:15:19 EDT 2008


I think we need to separate injection and component construction (/destruction).

It seems we're forgetting again that a component class = 1 bean class + interceptor classes. So interceptor lifecycle is tied to the bean. While injection follows the same rules.

At the end of the day I want to have something like:
package org.jboss.ejb3.pool;
  | 
  | /**
  |  * Creates and destroys stateless objects.
  |  * 
  |  * The object returned by create has dependencies injected. The PostConstruct
  |  * callback, if defined, has been called.
  |  *
  |  * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
  |  * @version $Revision: $
  |  */
  | public interface StatelessObjectFactory<T>
  | {
  |    /**
  |     * Creates a new stateless object by calling it's empty constructor,
  |     * do injection and calling post-construct.
  |     * 
  |     * @return
  |     */
  |    T create();
  |    
  |    /**
  |     * Perform any cleanup actions on the object, such as
  |     * calling the pre-destroy callback.
  |     * 
  |     * @param obj    the object
  |     */
  |    void destroy(T obj);
  | }
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/ejb3/trunk/pool/src/main/java/org/jboss/ejb3/pool/StatelessObjectFactory.java?view=markup

Behind the scenes it delegates to 'bean factory' for construction which delegates to injection for each object which is part of the component.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4136213#4136213

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4136213



More information about the jboss-dev-forums mailing list