resource factories & integration

From: Dhanji R. Prasanna <>
Date: Wed, 26 Mar 2008 12:41:51 +1100

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
- 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