Jul 2nd, 2006, 01:39 PM
Access application context from code without servlet context
Thanks for the quick reply.
I endeavored to wire everything and I did use nothing but singleton instances, so I guess I've got the spirit but I think I need to rethink the design.
Perhaps I've attempted to inject too much. Should I be injecting only those classes that can be singletons? Is that the gist of your suggestion that I redesign the services to be singletons?
The nature of several of our services is that they are very stateful. In addition to database queries, they often must calculate statistics on the result set and then trim the results based on those statistics. Obviously, this requires some stateful accumulator objects that can't be singletons.
I guess the question is, what should be spring injected and what shouldn't be spring injected? Should I look to injecting more factories rather than single instances of beans?