Re: JSR311: resource factories & integration

From: Bill Burke <>
Date: Tue, 25 Mar 2008 23:50:01 -0400

Dhanji R. Prasanna wrote:
> Hi
> I would like to resurrect my proposal several months ago for a pluggable
> factory for creating resource objects. I believe it had some support at
> the time, but the effort may have been waylaid by parallel work on a
> common ioc standard (?), which has since stalled.
> The benefits are numerous:
> - make it easy to integrate dependency injectors like Guice, spring,
> etc., in any environment
> - take advantage of scoping and other lifecycle provided by these
> external frameworks
> - take advantage of aop and interception provided by these frameworks
> - allow the possibility of constructor injection (can set final fields)
> and remove the objectionable no-arg constructor mandate
> The API is simple:
> public interface ResourceProvider {
> <T> T get(Class<T> clazz);
> }
> And can be registered once across the entire app. This can be made more
> generic and encompass Contexts too (replacing the current
> ContextResolver<T>).

What about @Context field injections? And I believe field injection of
the @Param types will make it in? How will this work with this simple

I have an abstraction I did that will support @Context field/setter
method/constructor param injection. As well as @*Param field/setter
injection once it gets into the specification. Here's a link, I'll
explain it if you want.

Works with singleton and object-per-request models. Works with Spring
(we have a Spring plugin). Works portably with EJBs, but does not
support field/setter/constructor injection portably with EJBs. In that
case you'd have to do special EJB container integration through the SPI.

Bill Burke
JBoss, a division of Red Hat