I will have to take a look at the ServiceLayerDecorator to see how that would work with Spring. Maybe that's is a better solution?
Any the @AutoWired annotation wont work since the ServiceLocator and RequestFactoryServlet is not managed by Spring (ie Spring did not create the objects, the servlet container did).
public class MyServiceLocator implements ServiceLocator {
public Object getInstance(Class<?> clazz) {
HttpServletRequest request = RequestFactoryServlet.getThreadLocalRequest();ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
//we should probably check class for null and return something the client can deal with
// just in case
return context.getBean(clazz);}}