Hi,

I'd like for my application specific extensions to stripes (type converters, 
interceptors, even action beans, etc) to be pulled out of the spring context.  
I've managed to do this somewhat by providing my own Configuration, but the 
implementation is far from ideal.  So I was thinking everywhere stripes calls 
class.newInstance(), could that be replaced by instantiator.newInstance(), 
where instantiator is a configurable component to provide new instances of a 
given class...

For example,

interface Instantiator {

      <T> T newInstance(Class<T> clazz) throws InstantiationException,
                  IllegalAccessException;
}


class DefaultInstantiator implements Instantiator {

      public <T> T newInstance(Class<T> clazz) throws InstantiationException,
                  IllegalAccessException {
            return clazz.newInstance();
      }
}


class SpringInstantiator extends DefaultInstantiator {

      @Override
      public <T> T newInstance(Class<T> clazz) throws InstantiationException,
                  IllegalAccessException {
            T bean = SpringUtil.getInstance().getBean(clazz);
            if (bean != null) {
                  return bean;
            }
            return super.newInstance(clazz);
      }
}

That would offer much better integration between stripes and spring / other DI 
frameworks.  This could also eliminate the @SpringBean annotation and allow 
action beans to use normal setter injection.  Thoughts?

-John
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to