title: Using Dependency Injection as an alternative to Singletons
body: <p>I've always known Singletons to be "bad", but only now that I've made the move to Java from C++ have I decided to find a way around them. From a bit of reading, I've found that either Factories or Dependency Injection could possibly do the job, but I'd like some confirmation on this.</p>
  
  <p>As an example, I was about to write a AnimationCache singleton that would store a <code>Map&lt;String, Animation&gt;</code>. Different classes should be able to have access to this class (basically) anywhere so that they can easily and efficiently load Animations. A very brief example of what the equivalent code would look like using DI would be great.</p>
  
  <p>Also, is Guice a good framework for DI with non-web apps? I have used Spring for web development, but I'm not so sure that'd work for games.</p>