Hello,

I've looked at the existing Spring integration work that has gone on and it looks pretty good. But it doesn't really do what I would like it to do. The way understand it, it really is only managing the component, application, and routing.

What I really would like to see is Spring managing the resources themselves. I actually don't mind wiring up that stuff myself, or creating a simple Application that loads a restlet.xml file and create my uri routing for my application. But I really want the ability to have Spring manage the creation of my Resources. This way, I can take full advantage of its dependency injection and and have all the goodness that I'm looking for.

One project we could probably model such behavior on is the Struts 2 framework. It has a similar idea, where you have your struts.xml file and it contains you configuration for your actions. By default, Struts2 will create your actions from the classnames that you provide. But you can use the Spring plugin or the Guice plugin or create a plugin for whatever other IoC container you want and have Struts2 use it for managing the creation of action objects.

I think this would give a ton of power to the Restlet developers, because then you would be able to develop a Restlet and have full access to the Spring framework. I know I would prefer something like

public class AccountsResource
       extends Resource {
   private List<Accounts> accounts;

public AccountsResource (Context context, Request request, Response response, AccountRepository repository) {
       super (context, request, response);
// perform lookup of accounts
       Accounts accounts = repository.getAll();
       getVariants ().add (new Variant (MediaType.APPLICATION_XHTML_XML));
   }
...
}

over something where I have to use the context to lookup the Spring application context and then lookup the bean of the type or name that I want and then use it. I think it would certainly spur faster adoption.

WDYT?

Rich

Reply via email to